-
-
Notifications
You must be signed in to change notification settings - Fork 297
ongoing windows username fix #2277
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
base: master
Are you sure you want to change the base?
Conversation
55d9ea7
to
f31234c
Compare
You are modifying libf3d public API! |
f31234c
to
dc6cc71
Compare
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.
Some suggestions could not be made:
- library/src/engine.cxx
- lines 17-17
@@ -1122,7 +1122,7 @@ int F3DStarter::Start(int argc, char** argv) | |||
} | |||
} | |||
|
|||
char* noDataForceRender = std::getenv("CTEST_F3D_NO_DATA_FORCE_RENDER"); | |||
std::optional<std::string> noDataForceRender = f3d::utils::getEnv("CTEST_F3D_NO_DATA_FORCE_RENDER"); |
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.
std::optional<std::string> noDataForceRender = f3d::utils::getEnv("CTEST_F3D_NO_DATA_FORCE_RENDER"); | |
std::optional<std::string> noDataForceRender = | |
f3d::utils::getEnv("CTEST_F3D_NO_DATA_FORCE_RENDER"); |
const char* envPtr = std::getenv(envVar.c_str()); | ||
if (!envPtr) | ||
std::optional<std::string> envVal = f3d::utils::getEnv(envVar); | ||
if (!envVal || envVal->empty() ) |
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.
if (!envVal || envVal->empty() ) | |
if (!envVal || envVal->empty()) |
@@ -68,6 +69,26 @@ class F3D_EXPORT utils | |||
[[nodiscard]] static std::filesystem::path collapsePath( | |||
const std::filesystem::path& path, const std::filesystem::path& baseDirectory = {}); | |||
|
|||
/** | |||
* Get an environnement variable value, returns std::nullopt if not set |
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.
* Get an environnement variable value, returns std::nullopt if not set | |
* Get an environment variable value, returns std::nullopt if not set |
switch(knownFolder) | ||
{ | ||
case KnownFolder::APPDATA: |
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.
switch(knownFolder) | |
{ | |
case KnownFolder::APPDATA: | |
switch (knownFolder) | |
case: | |
KnownFolder::LOCALAPPDATA winKnowFolder = FOLDERID_LocalAppData; |
{ | ||
return {}; | ||
} | ||
dirPath = fs::path(appData); | ||
dirPath = fs::path(*appData); |
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.
It's better to be explicit imho here
dirPath = fs::path(*appData); | |
dirPath = fs::path(appData.value()); |
*/ | ||
enum class KnownFolder : unsigned char | ||
{ | ||
APPDATA, |
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.
Let's use the official name
APPDATA, | |
ROAMINGAPPDATA, |
[[nodiscard]] static std::optional<std::string> getEnv(const std::string& env); | ||
|
||
/** | ||
* Enumeration of supported Windows known folders |
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.
Add the corresponding default values (%APPDATA%
and %LOCALAPPDATA%
respectively)
|
||
#include <nlohmann/json.hpp> | ||
|
||
/* |
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.
to remove
else | ||
{ | ||
return std::nullopt; | ||
} |
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.
else | |
{ | |
return std::nullopt; | |
} | |
return std::nullopt; |
Describe your changes
Not ready for merge
Issue ticket number and link if any
#2084
Checklist for finalizing the PR
.github/workflows/versions.json
, I have updatedtimestamp
Continuous integration
Please check the checkbox of the CI you want to run, then push again on your branch.