It is currently April 27th, 2024, 10:47 pm

[BUG?] WriteKeyValue using relative paths

Report bugs with the Rainmeter application and suggest features.
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

[BUG?] WriteKeyValue using relative paths

Post by Nookz »

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:
WriteKeyValue_relativePath_.rmskin
Is this a bug or is there something I'm unaware of that would cause this behaviour?
You do not have the required permissions to view the files attached to this post.
User avatar
Brian
Developer
Posts: 2688
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [BUG?] WriteKeyValue using relative paths

Post by Brian »

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
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] WriteKeyValue using relative paths

Post by Yincognito »

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.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth