Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@ryansg.com>2020-04-06 22:07:39 -0400
committerMike Gerwitz <mike.gerwitz@ryansg.com>2020-04-28 09:06:25 -0400
commitfbfb3c4ba2a90df028bd02e268ce286f99c3e16d (patch)
tree209a63acbfcc238f4ddc471446c0cf7ed3decaa9 /tamer/src/ld/poc.rs
parentd97e53a835cec970c103d10eaa9f4d1b93ee8a82 (diff)
downloadtame-fbfb3c4ba2a90df028bd02e268ce286f99c3e16d.tar.gz
tame-fbfb3c4ba2a90df028bd02e268ce286f99c3e16d.tar.bz2
tame-fbfb3c4ba2a90df028bd02e268ce286f99c3e16d.zip
[DEV-7084] TAMER: CanonicalFile
This will be entirely replaced in an upcoming commit. See that for details. I don't feel like dealing with the conflicts for rearranging and squashing these commits.
Diffstat (limited to 'tamer/src/ld/poc.rs')
-rw-r--r--tamer/src/ld/poc.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/tamer/src/ld/poc.rs b/tamer/src/ld/poc.rs
index 689aa9d..117aeca 100644
--- a/tamer/src/ld/poc.rs
+++ b/tamer/src/ld/poc.rs
@@ -20,7 +20,9 @@
//! **This is a poorly-written proof of concept; do not use!** It has been
//! banished to its own file to try to make that more clear.
-use crate::fs::{Filesystem, VisitOnceFile, VisitOnceFilesystem};
+use crate::fs::{
+ CanonicalFile, Filesystem, VisitOnceFile, VisitOnceFilesystem,
+};
use crate::global;
use crate::ir::asg::{
Asg, AsgError, DefaultAsg, IdentKind, IdentObject, IdentObjectData,
@@ -34,6 +36,7 @@ use std::convert::TryInto;
use std::error::Error;
use std::fs;
use std::io::BufReader;
+use std::path::PathBuf;
type LinkerAsg<'i> = DefaultAsg<'i, IdentObject<'i>, global::ProgIdentSize>;
type LinkerObjectRef = ObjectRef<global::ProgIdentSize>;
@@ -126,16 +129,17 @@ fn load_xmlo<'a, 'i, I: Interner<'i>>(
interner: &'i I,
roots: &mut Vec<LinkerObjectRef>,
) -> LoadResult<'i> {
- let path = fs::canonicalize(path_str)?;
let first = fs.visit_len() == 0;
let mut found: FxHashSet<&str> = Default::default();
- let file: fs::File = match fs.open(&path)? {
+ let cfile: CanonicalFile<fs::File> = match fs.open(path_str)? {
VisitOnceFile::FirstVisit(file) => file,
VisitOnceFile::Visited => return Ok(None),
};
+ let (path, file) = cfile.into();
+
let reader = BufReader::new(file);
let mut xmlo: XmloReader<'_, _, _> = (reader, interner).into();
let mut elig = None;
@@ -238,7 +242,7 @@ fn load_xmlo<'a, 'i, I: Interner<'i>>(
));
}
- let mut dir = path.clone();
+ let mut dir: PathBuf = path.clone();
dir.pop();
for relpath in found.iter() {