From 8334221f521b76a34abc3c896ac0e95eee8f2d3d Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sat, 8 Apr 2023 14:17:08 +0200 Subject: [PATCH 1/4] Compilation error when romfs can't be found --- ctru-rs/src/services/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ctru-rs/src/services/mod.rs b/ctru-rs/src/services/mod.rs index 6b9e1151..ec554cb5 100644 --- a/ctru-rs/src/services/mod.rs +++ b/ctru-rs/src/services/mod.rs @@ -34,6 +34,8 @@ cfg_if::cfg_if! { //! [package.metadata.cargo-3ds] //! romfs_dir = "romfs" //! ``` + + compile_error!("romfs feature is enabled but no romfs found!"); } } } From 78ba904ac0d1e3841e25ef98ea43719620ddde33 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sat, 8 Apr 2023 15:04:42 +0200 Subject: [PATCH 2/4] fmt --- ctru-rs/src/services/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctru-rs/src/services/mod.rs b/ctru-rs/src/services/mod.rs index ec554cb5..c466f048 100644 --- a/ctru-rs/src/services/mod.rs +++ b/ctru-rs/src/services/mod.rs @@ -34,7 +34,7 @@ cfg_if::cfg_if! { //! [package.metadata.cargo-3ds] //! romfs_dir = "romfs" //! ``` - + compile_error!("romfs feature is enabled but no romfs found!"); } } From d3134f68f66870b492537e10dfe5fd6d3e1e372f Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sat, 8 Apr 2023 20:20:01 +0200 Subject: [PATCH 3/4] Compilation error only if feature is set --- ctru-rs/src/services/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ctru-rs/src/services/mod.rs b/ctru-rs/src/services/mod.rs index c466f048..2c51d100 100644 --- a/ctru-rs/src/services/mod.rs +++ b/ctru-rs/src/services/mod.rs @@ -34,7 +34,9 @@ cfg_if::cfg_if! { //! [package.metadata.cargo-3ds] //! romfs_dir = "romfs" //! ``` - + + // If the feature is set, but no "romfs" directory was found: send an error during compilation. + #[cfg(feature = "romfs")] compile_error!("romfs feature is enabled but no romfs found!"); } } From 5a21920530fe6b829d09fead92e6234386957b2f Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sat, 8 Apr 2023 20:21:38 +0200 Subject: [PATCH 4/4] fmt --- ctru-rs/src/services/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctru-rs/src/services/mod.rs b/ctru-rs/src/services/mod.rs index 2c51d100..1d31deac 100644 --- a/ctru-rs/src/services/mod.rs +++ b/ctru-rs/src/services/mod.rs @@ -34,7 +34,7 @@ cfg_if::cfg_if! { //! [package.metadata.cargo-3ds] //! romfs_dir = "romfs" //! ``` - + // If the feature is set, but no "romfs" directory was found: send an error during compilation. #[cfg(feature = "romfs")] compile_error!("romfs feature is enabled but no romfs found!");