Skip to content

[Fix] Path not Writable + Disk Space Info #1575

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

Merged
merged 10 commits into from
Aug 7, 2022

Conversation

CommandMC
Copy link
Collaborator

@CommandMC CommandMC commented Jul 14, 2022

Plan for this is to finally fix this error once and for all. Right now, there's just some debug output for a person to test.


Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@CommandMC CommandMC self-assigned this Jul 14, 2022
@CommandMC CommandMC force-pushed the debug/win-path-not-writable branch from 3ab14e1 to 5d9055d Compare July 14, 2022 10:11
@Nocccer
Copy link
Collaborator

Nocccer commented Jul 14, 2022

Please make this a real PR. This is way better, to tell the user why it is not writeable. I assume if the folder does not exist, it will also print out an error.

Tested this PR. The warning occurs also if the path does not exist yet. We should try to find the base path and check that, instead the full path which will be created by legendary later on.

E.g.:
/home/user/Games => /home/user/ should be checked and not /home/user/Games, because Games is maybe not created yet.

@Nocccer
Copy link
Collaborator

Nocccer commented Jul 14, 2022

i wrote a function to get the existing root path.

import { existsSync } from 'graceful-fs'
import { normalize } from 'path'
  
export function getFirstExistingParentPath(directoryPath: string): string {
	let parentDirectoryPath = directoryPath
	let parentDirectoryFound = existsSync(parentDirectoryPath)

	while (!parentDirectoryFound) {
		parentDirectoryPath = normalize(parentDirectoryPath + '/..')
		parentDirectoryFound = existsSync(parentDirectoryPath)
	}

	return parentDirectoryPath !== '.' ? parentDirectoryPath : ''
}

https://replit.com/@Nocccer/getExistingRootPath?v=1

@flavioislima
Copy link
Member

@CommandMC is this still being worked on? I think would be good to fix this before the next release. What is left to do? Do you need help testing?

@CommandMC
Copy link
Collaborator Author

I didn't ever implement what @Nocccer suggested here, and somehow communicating if the path lookup failed is also still a TODO
Left this open in case someone else wants to work on it, I'm busy with #1633 right now

@flavioislima flavioislima added this to the 2.4.0 milestone Aug 4, 2022
@flavioislima flavioislima marked this pull request as ready for review August 4, 2022 21:55
@flavioislima
Copy link
Member

@Nocccer @CommandMC

Added two small changes:

  • Instead of checking if there is write permission on the folder now we check if there is write permission on the parent folder like was suggested. But I used a more simple approach using node dirname to get the parent. Makes more sense because you cannot have permission to write on a folder that doesn't exists.
  • Changed the translation now to be: Path might not exist or might not be writable. I believe it is more clear now.

@flavioislima flavioislima added the pr:ready-for-review Feature-complete, ready for the grind! :P label Aug 4, 2022
Copy link
Collaborator

@Nocccer Nocccer left a comment

Choose a reason for hiding this comment

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

I have some concerns.
Also if not done yet, update check-disk-space. I added a fix there, where check-disk-space fallsback to wmic if powershell was not found.

@flavioislima
Copy link
Member

Ok, added your code now @Nocccer
It is better now, will revert the i18n changes.

@flavioislima flavioislima requested a review from Nocccer August 5, 2022 13:48
Copy link
Collaborator

@Nocccer Nocccer left a comment

Choose a reason for hiding this comment

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

LGTM. Still think we should show the actually error in frontend. For access the path might not be writable is good but for check-disk-space we should show the actually error. E.g. du or whatever crahsed. I mean this should not happen, but better have this covered. Opinions?

@flavioislima
Copy link
Member

Wdym @Nocccer ?
The error is that you don't have enough disk space and that's what heroic showing I believe.
It checks first for permission and then the space left on the device and then we calc using the install game size.

@Nocccer
Copy link
Collaborator

Nocccer commented Aug 7, 2022

We had the problem where someone could not install the game, because it was shown no disk space 0gb of 0gb is available. Problem was that powershell was not on path and check-disk-space returned 0gb of 0gb, throwed the error ENOENT: powershell not found and we did not report the error to the frontend. So before someone opening another github issue or ask in discord, why not show the actually error in the frontend, so people can solve it by thereselfs. Means show ENOENT error for example instead of 0gb of 0gb available.

@flavioislima
Copy link
Member

Can you try removing the powershell from the path and try to make heroic work? Because heroic relies on powershell for everything on windows. This issue makes no sense to me.
Let's see if this will happen again since it seems a totally unrelated issue.
We will never be able to get all types of errors for every possible system configuration.
So next time someone has this please ping me so I can take a look.

@Nocccer
Copy link
Collaborator

Nocccer commented Aug 7, 2022

Can you try removing the powershell from the path and try to make heroic work? Because heroic relies on powershell for everything on windows. This issue makes no sense to me. Let's see if this will happen again since it seems a totally unrelated issue. We will never be able to get all types of errors for every possible system configuration. So next time someone has this please ping me so I can take a look.

Ok fair enough. Let's merge it. Btw are we already on check-disk-space 3.3.1?
I added a fix there to fallback to wmic if powershell is not found.
Alex-D/check-disk-space#21

@flavioislima
Copy link
Member

I'm not sure, I will update to latest before merging it 👍

@flavioislima flavioislima changed the title [Windows] Seems like the "Path is not writable" error is not fully gone yet [Fix] Path not Writable + Disk Space Info Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants