It is currently February 23rd, 2024, 4:55 am

[BUG?] WriteKeyValue using relative paths

Report bugs with the Rainmeter application and suggest features.
User avatar
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:
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
Posts: 2669
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).

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).

User avatar
Rainmeter Sage
Posts: 6781
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:
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