diff options
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; } |