diff options
author | Norbert Preining <norbert@preining.info> | 2019-11-07 03:01:39 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-11-07 03:01:39 +0000 |
commit | 2e1d63b8ed8c6b7c6d206bfe9e2712797108e8bd (patch) | |
tree | 7ea198b043998590117b2730e9dec10327ef3da3 /graphics/asymptote/locate.cc | |
parent | 590fd8b560523cdaea19c59aea61e781138e87f8 (diff) |
CTAN sync 201911070301
Diffstat (limited to 'graphics/asymptote/locate.cc')
-rw-r--r-- | graphics/asymptote/locate.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/graphics/asymptote/locate.cc b/graphics/asymptote/locate.cc index 7c6381e6b3..52967d9fbd 100644 --- a/graphics/asymptote/locate.cc +++ b/graphics/asymptote/locate.cc @@ -51,19 +51,18 @@ file_list_t mungeFileName(string id) return files; } -// Join a directory with the given filename, to give the path to the file. This -// also avoids unsightly joins such as './file.asy' in favour of 'file.asy' and -// 'dir//file.asy' in favour of 'dir/file.asy' -string join(string dir, string file) +// Join a directory with the given filename, to give the path to the file, +// avoiding unsightly joins such as 'dir//file.asy' in favour of 'dir/file.asy' +string join(string dir, string file, bool full) { - return dir == "." ? file : + return dir == "." ? (full ? string(getPath())+"/"+file : file) : *dir.rbegin() == '/' ? dir + file : dir + "/" + file; } // Find the appropriate file, first looking in the local directory, then the // directory given in settings, and finally the global system directory. -string locateFile(string id) +string locateFile(string id, bool full) { if(id.empty()) return ""; file_list_t filenames = mungeFileName(id); @@ -88,7 +87,7 @@ string locateFile(string id) for (file_list_t::iterator dir = searchPath.begin(); dir != searchPath.end(); ++dir) { - string file = join(*dir,*leaf); + string file = join(*dir,*leaf,full); if (fs::exists(file)) return file; } |