try relative to current working dir if can't find archive (need to search relative to .map too)
This commit is contained in:
parent
3ee28fc416
commit
b1b4cb0e09
34
common/fs.cc
34
common/fs.cc
|
|
@ -214,18 +214,8 @@ void clear()
|
||||||
directories.clear();
|
directories.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<archive_like> addArchive(const path &p, bool external)
|
inline std::shared_ptr<archive_like> addArchiveInternal(const path &p, bool external)
|
||||||
{
|
{
|
||||||
if (p.empty()) {
|
|
||||||
logging::funcprint("WARNING: can't add empty archive path\n");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!exists(p)) {
|
|
||||||
logging::funcprint("WARNING: archive '{}' not found\n", p);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_directory(p)) {
|
if (is_directory(p)) {
|
||||||
for (auto &dir : directories) {
|
for (auto &dir : directories) {
|
||||||
if (equivalent(dir->pathname, p)) {
|
if (equivalent(dir->pathname, p)) {
|
||||||
|
|
@ -267,6 +257,28 @@ std::shared_ptr<archive_like> addArchive(const path &p, bool external)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<archive_like> addArchive(const path &p, bool external)
|
||||||
|
{
|
||||||
|
if (p.empty()) {
|
||||||
|
logging::funcprint("WARNING: can't add empty archive path\n");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!exists(p)) {
|
||||||
|
// check relative
|
||||||
|
path filename = p.filename();
|
||||||
|
|
||||||
|
if (!exists(filename)) {
|
||||||
|
logging::funcprint("WARNING: archive '{}' not found\n", p);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return addArchiveInternal(filename, external);
|
||||||
|
}
|
||||||
|
|
||||||
|
return addArchiveInternal(p, external);
|
||||||
|
}
|
||||||
|
|
||||||
resolve_result where(const path &p, bool prefer_loose)
|
resolve_result where(const path &p, bool prefer_loose)
|
||||||
{
|
{
|
||||||
// check direct archive loading first; it can't ever
|
// check direct archive loading first; it can't ever
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue