electron-lets-move
electron-lets-move copied to clipboard
Moves to ~/Applications instead of /Applications
Password request dialog is popping up but the file is being moved to ~/Applications
instead of /Applications
. I don't use ~/Applications
but Chrome has placed a few folders in there so the path exists. This is confusing as all my apps are usually placed in the root /Applications
.
The logic here is the same as lets-move
. If a user Applications folder exists then the module uses it. I think this is best for folks in more locked down environments but I agree it's not ideal in this case…
I wonder how this could be improved, perhaps look at which folder is used more?
Yeah, perhaps if the user Applications folder had to have more top-level files/folders than the root Applications folder (or at least some minimum fraction of it). In my case, I didn't even know that ~/Applications
existed, I was only able to find my app using spotlight.
I'd always favour the root /Applications
folder over the user ~/Applications
folder when moving. But allow the App to run in both locations without suggesting to move.
Hey @tommoor, any update on this?
I made an update here to solve this issue. It updates it so you can pass an object to the function that has the optional callback and also a preferRoot
boolean.
See: https://github.com/mattdelliott/electron-lets-move/commit/993c3691a74e750c7b5e1313f096f320594237e6
I will issue a PR and you can merge it if you want to.
https://github.com/tommoor/electron-lets-move/pull/7
@mattdelliott I've already implemented that locally on my app, but the main problem now is that the module asks for sudo even if the user has permission to make changes to the Applications folder. Any idea why that's happening?
I'm not sure, I'll have to look into it to see if I can figure out why. I noticed it happened even with ~/Applications
.
It should only ask for the admin password if the user doesn't have the correct permissions to write to the Applications folder, but right now it asks all users regardless.
Changing callback(null, !err);
to callback(null, err);
on line 20 "fixes" the issue for normal users but for users who don't have the permissions for the Applications folder simply don't get the "Move Applications" dialog.
I think what is going on is it's looking at file permissions on a file that doesn't exist. Instead of checking permissions on the directory, it's checking them on the directory + yourappname.app which obviously does not exist at that point. I can make an update to fix that and add it to the PR
Ah, I didn't think about that. A fix would be appreciated! :)
I added a commit to #7 to fix the issue. Still kept it at v0.0.6 though.
@MehediH after talking with @tommoor I made changes to how it functions. It'll now accept the callback only instead of the options object. What it does instead is prefers root by default if the user has permission. If they do not, it will move it to their applications folder if it exists. If it does not exist, it will ask for permission to write to root.
@mattdelliott Good stuff, but I'm getting an error on a fake account with parental control that I made. The move application dialog opens up, but when you click on Move Application, there's a warning saying "You don't have permission to use the application "Tweeten (my app name) Password Prompt."
So you clicked it and then it moved it and tried to launch the moved version of it and you got that prompt? Where did it move it? root or ~?
It did not move, just showed me the error with that message.
Wondering if it needs sudo access to move into the ~/Applications folder. Let me try updating that and see if it works.
I updated the logic to check if there is write access to the ~/Applications folder. If there isn't, it'll prefer root since it requires sudo anyway. Not sure if it'll solve that issue with Parental Controls or not.
Weird, still getting the same error dialog.