I have come across something that I don't think is mentioned anywhere in the manual:
Trying to use a relative path in WriteKeyValue seems to always give an 'Illegal path' error in the log.
I've attached a very simple example:
Is this a bug or is there something I'm unaware of that would cause this behaviour?
It is currently April 28th, 2024, 2:50 am
[BUG?] WriteKeyValue using relative paths
-
- Posts: 55
- Joined: November 3rd, 2023, 7:22 pm
[BUG?] WriteKeyValue using relative paths
You do not have the required permissions to view the files attached to this post.
-
- Developer
- Posts: 2688
- Joined: November 24th, 2011, 1:42 am
- Location: Utah
Re: [BUG?] WriteKeyValue using relative paths
I am not sure this qualifies as a bug or not, but what I can tell you is that any use of the ..\ is getting flagged by Rainmeter as invalid since we restrict the FilePath parameter to the #SKINSPATH# or #SETTINGSPATH# paths. This is to prevent writing to other parts of the OS (even though that can be done other ways).
https://docs.rainmeter.net/manual/bangs/#WriteKeyValue
Typically a relative path starts with the "relative part", like ..\..\SomeFolder\SomeFile.ext. Mixing a relative path within an absolute path (like C:\Users\XXXX\Documents\Rainmeter\Skins\SomeSkin\SubFolder1\..\SomeFile.ext), while perfectly valid in some cases, wasn't really accounted for when implementing this bang.
For now, avoid using ..\ with !WriteKeyValue. I will look into "normalizing" a path before checking for validity, but it may have to wait until Windows 7 is dropped (which is coming sooner rather than later).
-Brian
https://docs.rainmeter.net/manual/bangs/#WriteKeyValue
Typically a relative path starts with the "relative part", like ..\..\SomeFolder\SomeFile.ext. Mixing a relative path within an absolute path (like C:\Users\XXXX\Documents\Rainmeter\Skins\SomeSkin\SubFolder1\..\SomeFile.ext), while perfectly valid in some cases, wasn't really accounted for when implementing this bang.
For now, avoid using ..\ with !WriteKeyValue. I will look into "normalizing" a path before checking for validity, but it may have to wait until Windows 7 is dropped (which is coming sooner rather than later).
-Brian
-
- Rainmeter Sage
- Posts: 7178
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: [BUG?] WriteKeyValue using relative paths
For future readers - if any - that may look for a workaround on this that they could use for now:
https://forum.rainmeter.net/viewtopic.php?t=43233&start=10#p219845
Of course, while in itself the above has no restrictions on the parent folder one is looking for, using the outcome in a !WriteKeyValue bang will still be subject to limiting the path to be under the Rainmeter's skins or settings path, as noted by Brian above.
https://forum.rainmeter.net/viewtopic.php?t=43233&start=10#p219845
Of course, while in itself the above has no restrictions on the parent folder one is looking for, using the outcome in a !WriteKeyValue bang will still be subject to limiting the path to be under the Rainmeter's skins or settings path, as noted by Brian above.