Skip to content

Commit

Permalink
show full path for cpp warning (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson authored Mar 2, 2024
1 parent 6f55782 commit 2c9f8f3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bin/src/modules/rapifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,17 @@ pub fn rapify(addon: &Addon, path: &WorkspacePath, ctx: &Context) -> Result<Repo
}

pub fn can_rapify(path: &str) -> bool {
let path = PathBuf::from(path);
let ext = path
let pathbuf = PathBuf::from(path);
let ext = pathbuf
.extension()
.unwrap_or_else(|| std::ffi::OsStr::new(""))
.to_str()
.unwrap();
if ext == "cpp" && path.file_name() != Some(std::ffi::OsStr::new("config.cpp")) {
warn!("{} - cpp files other than config.cpp are usually not intentional. use hpp for includes", path.file_name().unwrap().to_str().unwrap());
if ext == "cpp" && pathbuf.file_name() != Some(std::ffi::OsStr::new("config.cpp")) {
warn!(
"{} - cpp files other than config.cpp are usually not intentional. use hpp for includes",
path.trim_start_matches('/')
);
}
["cpp", "rvmat", "ext"].contains(&ext)
}

0 comments on commit 2c9f8f3

Please sign in to comment.