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

Ensure shortcut set explicit working directory #1319

Closed
wants to merge 1 commit into from

Conversation

wangzq
Copy link
Contributor

@wangzq wangzq commented Feb 4, 2017

Ideally we should let the manifest specify a working directory, but for now let's at least make sure it is by default set to the directory of the shortcut's target.

@lukesampson
Copy link
Member

What are the side effects of not having a working directory set?

@wangzq
Copy link
Contributor Author

wangzq commented Feb 4, 2017

The working directory will be "random" and some programs which need to read some files from the base directory will not work. After a second thought, while setting this always to the directory of the target should be fine and helps for those programs, it may still not work for all programs and it is not clean. I am thinking about adding a third item to the shortcut array like this: ["path", "Name", "workdir"], of course the third one will be optional. One small concern about this is that since it is an array instead of an object, it is not easy to tell which one is for which, maybe we could add the third array item as an object, I am thinking about just using all the read/write property names of the shortcut object as-is:

Arguments        Property   string Arguments () {get} {set}
Description      Property   string Description () {get} {set}
Hotkey           Property   string Hotkey () {get} {set}
IconLocation     Property   string IconLocation () {get} {set}
TargetPath       Property   string TargetPath () {get} {set}
WindowStyle      Property   int WindowStyle () {get} {set}
WorkingDirectory Property   string WorkingDirectory () {get} {set}

in manifest:

"shortcuts": [
    [ "$dir\\program.exe", "Name of the Program", { "WorkingDirectory": "$dir" }]
]

Then we can just apply the properties to the created shortcut object by enumerating all the properties of the optional third object in manifest.

Let me know which approach you prefer.

Thanks

@wangzq
Copy link
Contributor Author

wangzq commented Feb 4, 2017

@lukesampson P.S. Can you share info on how do you test scoop while developing it? The scoop command will be still using the installed version instead of the cloned/forked copy I made the changes?

@wangzq
Copy link
Contributor Author

wangzq commented Feb 4, 2017

I used set-alias scoop c:\github\scoop\bin\scoop.ps1 to test the changes; I will abandon this and create a new PR with the other approach I mentioned above.

@r15ch13
Copy link
Member

r15ch13 commented Oct 9, 2017

OBS Studio need a correct WorkingDirectory to start properly.

Rufus doesn't start in portable mode if it can't find rufus.ini in it's working directory (which is set to C:\Windows\System32\ when started from start menu)
See ScoopInstaller/Extras#579

Every program installed on windows sets the working directory the same as the main executable. I think we should default to this behavior.

@r15ch13 r15ch13 reopened this Oct 9, 2017
r15ch13 added a commit that referenced this pull request Jan 8, 2018
* Solves #1319, #1320, #1378, #1757, #1846, #1867
* Add WorkingDirectory
* Add Icon
* Add Arguments
* Use FileInfo and DirectoryInfo
@r15ch13
Copy link
Member

r15ch13 commented Jan 8, 2018

Added with 83b8238

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.

3 participants