summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/locate.cc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-11-06 22:15:00 +0000
committerKarl Berry <karl@freefriends.org>2019-11-06 22:15:00 +0000
commit8d918f88e6d576dc1612e5625a0ad802d17c8e13 (patch)
tree7866459f67ba7f4c37d87cf9ea8846b37915fadc /Build/source/utils/asymptote/locate.cc
parenteb21dd9dc04d18b2ceda665ab6272d4a97926f38 (diff)
asy 2.60 sources
git-svn-id: svn://tug.org/texlive/trunk@52659 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/locate.cc')
-rw-r--r--Build/source/utils/asymptote/locate.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/Build/source/utils/asymptote/locate.cc b/Build/source/utils/asymptote/locate.cc
index 7c6381e6b39..52967d9fbdb 100644
--- a/Build/source/utils/asymptote/locate.cc
+++ b/Build/source/utils/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;
}