file.exists, ... completely nothrow
This commit is contained in:
parent
5f00cf0d5b
commit
57fd91b417
@ -139,7 +139,7 @@ static fs::path toCanonic(fs::path path) {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::path EnginePaths::resolve(std::string path) {
|
fs::path EnginePaths::resolve(std::string path, bool throwErr) {
|
||||||
size_t separator = path.find(':');
|
size_t separator = path.find(':');
|
||||||
if (separator == std::string::npos) {
|
if (separator == std::string::npos) {
|
||||||
throw files_access_error("no entry point specified");
|
throw files_access_error("no entry point specified");
|
||||||
@ -165,7 +165,10 @@ fs::path EnginePaths::resolve(std::string path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (throwErr) {
|
||||||
throw files_access_error("unknown entry point '"+prefix+"'");
|
throw files_access_error("unknown entry point '"+prefix+"'");
|
||||||
|
}
|
||||||
|
return fs::path(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResPaths::ResPaths(fs::path mainRoot, std::vector<PathsRoot> roots)
|
ResPaths::ResPaths(fs::path mainRoot, std::vector<PathsRoot> roots)
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public:
|
|||||||
|
|
||||||
std::vector<fs::path> scanForWorlds();
|
std::vector<fs::path> scanForWorlds();
|
||||||
|
|
||||||
fs::path resolve(std::string path);
|
fs::path resolve(std::string path, bool throwErr=true);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PathsRoot {
|
struct PathsRoot {
|
||||||
|
|||||||
@ -26,7 +26,7 @@ static fs::path resolve_path_soft(const std::string& path) {
|
|||||||
if (path.find(':') == std::string::npos) {
|
if (path.find(':') == std::string::npos) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
return resolve_path(path);
|
return engine->getPaths()->resolve(path, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_file_find(lua_State* L) {
|
static int l_file_find(lua_State* L) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user