Scoop icon indicating copy to clipboard operation
Scoop copied to clipboard

Shims for relative paths

Open excitoon opened this issue 6 years ago • 4 comments

Hi.

Can we have a possibility to specify relative paths in shims? Like this:

path = ../apps/<app>/current/app.exe

That will allow users to simply move 'scoop' folder from machine to machine or from user to user. Now we have absolute paths, and this is not much useful.

excitoon avatar Dec 20 '18 11:12 excitoon

I've remembered another reason. Making paths relative will allow users to prepare software bundles in order to run in some isolated environments. For example, I want to run some tools in another computer without Internet, and I simply copy scoop folder using a flash drive (and add shims to PATH).

I would not mind any reason to keep them absolute though. Personally, I think it is more handy to get rid of absolute paths where it is possible.

excitoon avatar Dec 24 '18 09:12 excitoon

Hi. What do you think about this change?

excitoon avatar Feb 21 '19 13:02 excitoon

Sorry for the late review.

There is no need to call GetDirectoryName() and GetExecutingAssembly() because the results are already available from line 67-69.

https://github.com/lukesampson/scoop/blob/0215c7bc0b3ce542162f078b4cf303238ae719b7/supporting/shimexe/shim.cs#L67-L69

Therefore it's enough to call the following:

            if (!System.IO.Path.IsPathRooted(path)) {
                // allow relative path to exe
                path = Path.Combine(dir, path);
            }

This requires changes to shim() to function.

r15ch13 avatar Feb 24 '19 12:02 r15ch13

I think it's better to introduce a environment variable substitution here instead of fixed relative paths.

Also it's upset the PR is not reviewed for years.

puxu-msft avatar Mar 19 '22 05:03 puxu-msft