IO: relative paths are appended to all known paths
parent
5266f7e43e
commit
e5a30ddba9
|
@ -1,6 +1,7 @@
|
|||
vengi (0.0.17.0-1) UNRELEASED; urgency=low
|
||||
|
||||
* General:
|
||||
* Fixed relative path handling for registered paths
|
||||
|
||||
-- Martin Gerhardy <martin.gerhardy@gmail.com> Mon, 27 Dec 2021 12:01:08 +0100
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@ Known [issues](https://github.com/mgerhardy/engine/issues?q=is%3Aissue+is%3Aopen
|
|||
|
||||
## 0.0.17 (2021-XX-XX)
|
||||
|
||||
General:
|
||||
|
||||
- Fixed relative path handling for registered paths
|
||||
|
||||
## 0.0.16 (2021-12-27)
|
||||
|
||||
General:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Generate a lod scaled by 50% from the input model.
|
||||
|
||||
`./vengi-voxconvert -s --input infile.vox output.vox`
|
||||
`./vengi-voxconvert -s --input infile.vox --output output.vox`
|
||||
|
||||
## Merge several models
|
||||
|
||||
|
|
|
@ -477,6 +477,20 @@ io::FilePtr Filesystem::open(const core::String& filename, FileMode mode) const
|
|||
Log::debug("loading file %s from %s", filename.c_str(), p.c_str());
|
||||
return core::make_shared<io::File>(fullpath, mode);
|
||||
}
|
||||
if (isRelativePath(p)) {
|
||||
for (const core::String& s : _paths) {
|
||||
if (s == p) {
|
||||
continue;
|
||||
}
|
||||
const core::String fullrelpath = s + p + filename;
|
||||
io::File fullrelFile(fullrelpath, FileMode::Read);
|
||||
if (fullrelFile.exists()) {
|
||||
fullrelFile.close();
|
||||
Log::debug("loading file %s from %s%s", filename.c_str(), s.c_str(), p.c_str());
|
||||
return core::make_shared<io::File>(fullrelpath, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Log::debug("Use %s from %s", filename.c_str(), _basePath.c_str());
|
||||
return core::make_shared<io::File>(_basePath + filename, mode);
|
||||
|
|
|
@ -64,6 +64,10 @@ public:
|
|||
|
||||
const Paths& paths() const;
|
||||
|
||||
/**
|
||||
* @param[in] path If this is a relative path the filesystem will append this relative path to all
|
||||
* known search paths when trying to find a file.
|
||||
*/
|
||||
bool registerPath(const core::String& path);
|
||||
|
||||
core::String downloadDir() const;
|
||||
|
|
Loading…
Reference in New Issue