mirror of
https://github.com/github/codeql.git
synced 2026-02-19 16:33:40 +01:00
Canonicalize source file paths in main
This commit is contained in:
@@ -17,7 +17,9 @@ pub fn create(language: Language, schema: Vec<Entry>) -> Extractor {
|
||||
|
||||
Extractor { parser, schema }
|
||||
}
|
||||
|
||||
impl Extractor {
|
||||
/// Extracts the source file at `path`, which is assumed to be canonicalized.
|
||||
pub fn extract<'a>(&'a mut self, path: &Path) -> std::io::Result<Program> {
|
||||
let span = span!(
|
||||
Level::TRACE,
|
||||
@@ -48,7 +50,7 @@ impl Extractor {
|
||||
"files".to_owned(),
|
||||
vec![
|
||||
Arg::Label(file_label),
|
||||
Arg::String(format!("{}", path.canonicalize()?.display())),
|
||||
Arg::String(format!("{}", path.display())),
|
||||
Arg::String(format!("{}", path.file_name().unwrap().to_string_lossy())),
|
||||
Arg::String(format!("{}", path.extension().unwrap().to_string_lossy())),
|
||||
Arg::Int(1), // 1 = from source
|
||||
|
||||
@@ -40,7 +40,7 @@ fn main() -> std::io::Result<()> {
|
||||
let schema = node_types::read_node_types_str(tree_sitter_ruby::NODE_TYPES)?;
|
||||
let mut extractor = extractor::create(language, schema);
|
||||
for line in std::io::BufReader::new(file_list).lines() {
|
||||
let path = PathBuf::from(line?);
|
||||
let path = PathBuf::from(line?).canonicalize()?;
|
||||
let trap_file = path_for(&trap_dir, &path, ".trap");
|
||||
let src_archive_file = path_for(&src_archive_dir, &path, "");
|
||||
let trap = extractor.extract(&path)?;
|
||||
|
||||
Reference in New Issue
Block a user