thatsIch / sublime-rainmeter

Rainmeter Package for Sublime Text 3
https://thatsich.github.io/sublime-rainmeter/
MIT License
51 stars 3 forks source link

Refresh config function doesn't work with symlinks #54

Closed raiguard closed 6 years ago

raiguard commented 7 years ago

My Rainmeter projects are managed in a separate folder, and symlinked into the Rainmeter skins folder. When the package tries to refresh any of the skins in a symlinked config, it results in a "The config could not be found" error. However, all regular, non-symlinked skins will refresh just fine.

thatsIch commented 7 years ago

I will take a look into it. There is probably a way for Python to correctly detect symlinks, too. Thanks for the report!

I do not have much time atm, but I will take a look at it asap

thatsIch commented 6 years ago

@raiguard could you try the latest build from https://ci.appveyor.com/project/thatsIch/sublime-rainmeter/branch/master/artifacts and tell me if it works?

raiguard commented 6 years ago

Sorry for the late reply. No, now it doesn't work with any of the skins, even the ones that aren't symlinked.

thatsIch commented 6 years ago

ok, I guess I have to set up a testing bench. Could you describe me in more details your setup so I can replicate it?

raiguard commented 6 years ago

I’ll do my best, but I’m on a school trip at the moment so I don’t have access to my PC.

All of my Rainmeter projects (because I have several) are under D:/Caleb/Development/Rainmeter/Projects. For any that are using GitHub (e.g. ModernGadgets), the skins would be contained in D:/Caleb/Development/Rainmeter/Projects/ModernGadgets/Skins/ModernGadgets. That folder is symlinked (as a junction) to D:/Settings/Caleb/Rainmeter/Skins/ModernGadgets.

Let me know if you need any more info, I’ll do my best.

thatsIch commented 6 years ago

ok, I'll take a look. Sounds like easy to replicate

thatsIch commented 6 years ago

Ok, this is from the current point of view no easy task.

The problem is, that your symlinked folder has no clue that it is symlinked. I go see, if I find a decent workaround for it

thatsIch commented 6 years ago

I cannot assume that the symlinked folder and the symlink have the same name

thatsIch commented 6 years ago

Rainmeter requires the name of the symlink

thatsIch commented 6 years ago

Python can't follow the symlinks as it does not detect them. Even if I turn off link following it still lists them. Apparently, it is a bug on windows.

thatsIch commented 6 years ago

I found a way since Rainmeter is only on Windows to use the ctypes API, especially ctypes.windll.kernel32.GetFileAttributesW to detect if a folder is a symlink

thatsIch commented 6 years ago

Even then it just detects the ReparsePoint and does not indicate if it is really a symbolic link.

thatsIch commented 6 years ago

You can do something like calling a dir process and check its attributes like in

https://stackoverflow.com/a/27160885/2787159

thatsIch commented 6 years ago

I fixed the config detection for now, but the refresh still does not work since the file could not been extracted, but should be easy for now

thatsIch commented 6 years ago

Could you try the latest version on the CI?

https://ci.appveyor.com/project/thatsIch/sublime-rainmeter/branch/master/artifacts

If you confirm it working, I will release it as the next revision.