Skip to content
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

fix: add folder fallback to prevent app crash #135

Merged
merged 3 commits into from
Nov 13, 2024
Merged

Conversation

Saschl
Copy link
Contributor

@Saschl Saschl commented Nov 13, 2024

If Windows Controlled Folder access is enabled, it will prevent simbridge from accessing the documents folder and the app will crash. Added a fallback to use the appdata directory, which is not protected by default.

Note: the old workaround via powershell was removed, as the reason for platform-folders to fail was Windows blocking it as well. So it's not needed anymore IMO.

Fixes #134
Fixes #133
Fixes #130

Copy link
Member

@alepouna alepouna left a comment

Choose a reason for hiding this comment

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

Some comments, otherwise LGTM

apps/server/src/utilities/pathUtil.ts Outdated Show resolved Hide resolved

export const getSimbridgeDir = () => {
try {
return path.join(getPath('documents'), 'FlyByWireSim', 'Simbridge');
} catch (e) {
Logger.warn('Could not get documents path via WinAPI, trying alternate method', e);
Logger.warn(
'Could not get documents path via WinAPI, Windows Controlled Folder Access is likely blocking the app. Using AppData as fallback',
Copy link
Member

Choose a reason for hiding this comment

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

Could we note here a documentation link to either MS or our docs for how to override WCFA if someone wants to do this? Note as a comment on the code, not the log message FYI.

Copy link
Member

Choose a reason for hiding this comment

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

Do we need this ? No user is gonna look in the code and as a dev one should be able to use google :D Especially since that link will likely eventually go stale and will need updating. If anything I would suggest making a bot command for support that links to the relevant MS docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also the console closes by default so only who either disabled the setting or opens it manually will see the error message. Bot command sounds fine to me

@Saschl Saschl merged commit 08f0195 into main Nov 13, 2024
1 check passed
@Saschl Saschl deleted the fix/appdata-fallback branch November 13, 2024 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants