Merge pull request #3678 from rtfeldman/no-canonicalize

Don't use fs::canonicalize in CLI
This commit is contained in:
Folkert de Vries 2022-08-02 14:08:19 +02:00 committed by GitHub
commit e09739caec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -336,11 +336,7 @@ pub fn test(matches: &ArgMatches, triple: Triple) -> io::Result<i32> {
let path = Path::new(filename);
// Spawn the root task
let path = path.canonicalize().unwrap_or_else(|err| {
use io::ErrorKind::*;
match err.kind() {
NotFound => {
if !path.exists() {
let path_string = path.to_string_lossy();
// TODO these should use roc_reporting to display nicer error messages.
@ -356,11 +352,6 @@ pub fn test(matches: &ArgMatches, triple: Triple) -> io::Result<i32> {
process::exit(1);
}
_ => {
todo!("TODO Gracefully handle opening {:?} - {:?}", path, err);
}
}
});
let arena = &arena;
let target = &triple;
@ -372,7 +363,7 @@ pub fn test(matches: &ArgMatches, triple: Triple) -> io::Result<i32> {
let loaded = roc_load::load_and_monomorphize(
arena,
path,
path.to_path_buf(),
subs_by_module,
target_info,
// TODO: expose this from CLI?
@ -507,11 +498,7 @@ pub fn build(
let path = Path::new(filename);
// Spawn the root task
let path = path.canonicalize().unwrap_or_else(|err| {
use io::ErrorKind::*;
match err.kind() {
NotFound => {
if !path.exists() {
let path_string = path.to_string_lossy();
// TODO these should use roc_reporting to display nicer error messages.
@ -527,17 +514,12 @@ pub fn build(
process::exit(1);
}
_ => {
todo!("TODO Gracefully handle opening {:?} - {:?}", path, err);
}
}
});
let target_valgrind = matches.is_present(FLAG_VALGRIND);
let res_binary_path = build_file(
&arena,
&triple,
path,
path.to_path_buf(),
opt_level,
emit_debug_info,
emit_timings,