-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve URIs relative to file path #1373
Changes from 2 commits
eb74c67
0314f80
a83998c
70e897e
f092180
e973d80
143f1b0
c130219
443dfd2
f51bd4b
83af965
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
*/ | ||
|
||
#include <cstdlib> | ||
#include <filesystem> | ||
#include <fstream> | ||
#include <sstream> | ||
#include <functional> | ||
|
@@ -115,6 +116,16 @@ | |
{ | ||
return path; | ||
} | ||
else if (!_config.FilePath().empty()) | ||
{ | ||
auto p = std::filesystem::path(_config.FilePath()).parent_path(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would recommend storing the parent path directly in
(the names probably need work) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved path manipulation logic out of this function in a83998c. I didn't add the second arg though ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
p = p / filename; | ||
path = p.string(); | ||
if (sdf::filesystem::exists(path)) | ||
{ | ||
return path; | ||
} | ||
} | ||
} | ||
|
||
// Next check the install path. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be more specific with this naming, like
URIRelativePath
becauseFilePath
is already used in theElement
class and many other DOM classes that are loaded directly from a file, but sinceParserConfig
represents configuration, not data loaded from a file, I would use a different nameThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave a shot at naming:
SetRelativeURISearchPath
. Not tied to it, happy to change to a better name. a83998cThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good