Skip to content

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mwestphal
Copy link
Member

@mwestphal mwestphal commented May 27, 2025

Describe your changes

Not ready for merge

Issue ticket number and link if any

#2084

Checklist for finalizing the PR

  • I have performed a self-review of my code
  • I have added tests for new features and bugfixes
  • I have added documentation for new features
  • If it is a modifying the libf3d API, I have updated bindings
  • If it is a modifying the .github/workflows/versions.json, I have updated timestamp

Continuous integration

Please check the checkbox of the CI you want to run, then push again on your branch.

  • Style checks
  • Fast CI
  • Coverage cached CI
  • Analysis cached CI
  • WASM docker CI
  • Android docker CI
  • macOS Intel cached CI
  • macOS ARM cached CI
  • Windows cached CI
  • Linux cached CI
  • Other cached CI

@mwestphal mwestphal force-pushed the fix_windows_username branch from 55d9ea7 to f31234c Compare May 27, 2025 07:01
Copy link

You are modifying libf3d public API! ⚠️Please update bindings accordingly⚠️!
You can find them in their respective directories: python, java, webassembly.

@mwestphal mwestphal marked this pull request as ready for review May 28, 2025 06:54
@mwestphal mwestphal force-pushed the fix_windows_username branch from f31234c to dc6cc71 Compare May 28, 2025 06:54
Copy link

@github-actions github-actions bot left a 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");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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() )

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Get an environnement variable value, returns std::nullopt if not set
* Get an environment variable value, returns std::nullopt if not set

Comment on lines +146 to +148
switch(knownFolder)
{
case KnownFolder::APPDATA:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
switch(knownFolder)
{
case KnownFolder::APPDATA:
switch (knownFolder)
case:
KnownFolder::LOCALAPPDATA winKnowFolder = FOLDERID_LocalAppData;

{
return {};
}
dirPath = fs::path(appData);
dirPath = fs::path(*appData);
Copy link
Member

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

Suggested change
dirPath = fs::path(*appData);
dirPath = fs::path(appData.value());

*/
enum class KnownFolder : unsigned char
{
APPDATA,
Copy link
Member

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

Suggested change
APPDATA,
ROAMINGAPPDATA,

[[nodiscard]] static std::optional<std::string> getEnv(const std::string& env);

/**
* Enumeration of supported Windows known folders
Copy link
Member

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>

/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to remove

Comment on lines +135 to +138
else
{
return std::nullopt;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
else
{
return std::nullopt;
}
return std::nullopt;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants