It is currently March 29th, 2024, 12:21 am

Variables getting overwritten on install even though Variable file added to package installer

Report bugs with the Rainmeter application and suggest features.
User avatar
mpurses
Posts: 15
Joined: May 12th, 2020, 6:17 pm

Re: Variables getting overwritten on install even though Variable file added to package installer

Post by mpurses »

SilverAzide wrote: November 8th, 2020, 12:59 am Just curious, something I meant to ask you before. Has your Documents folder (usually C:\Users\<username>\Documents) been redirected to OneDrive? The reason I ask is my company recently did some magic jujitsu group policy crap and remapped my Documents folder to a corporate OneDrive folder. A number of apps I use (not only Rainmeter, but stuff like Visual Studio), completely crashed and burned by doing this. Took me days of remapping away from that folder to get things to function again, including changing Rainmeter's default SkinPath.
Ya everything is mapped to C:\Users\<username>\OneDrive\Documents\Rainmeter. And I agree it's a pain in the ass every time I mess with different back-up/file sync programs. (Google Drive was by far the worst for me with file permission issues).

I just tried moving everything to outside of Onedrive and remapped rainmeter. But it looks like I'm still running into the exact same issues. (I get backup fails too) So I guess Onedrive is not my issue, still could be weird permission issues though.
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Variables getting overwritten on install even though Variable file added to package installer

Post by Brian »

First, I just want to apologize for the lack of communication. I have had some family medical issues recently and haven't had little time to really look at this.


So, as SilverAzide eluded to previously, this is mostly a documentation issue. Our "tips" articles are usually not written by the developer who implemented the feature and sometimes small details like this can be missed. On top of that, the UI should really disable the "Variables files" option when "Merge skins" is selected, which I will discuss later.


A clue to the problem lies here: https://docs.rainmeter.net/manual/distributing-skins/#MergeSkins
Rainmeter Docs wrote: If selected, the Skin Installer will not remove any existing files found in the user's Skins directory. (Normally, the root config folder is removed and replaced with the version in the skin package.) This can be used to install an "expansion" or a "patch" to a previously-installed skin, without duplicating unchanged files.
Note the underlined text.

What this means is using the "Merge skins" option DOES NOT backup anything. It simply merges the files in the rmskin with the existing skin. You might say "Duh", but what is not clear is how the "Variables files" work. As I recently posted in another thread, the "Variables files" option relies on using the backed up skins (from the existing skin) and replacing the newly installed variables with the older existing ones from the backup.

In other words, the "Variables files" option is not compatible with the "Merge skins" option - hence the reason why there is extra checking in the code.


Rainmeter should really disable the "Variables files" field when the "Merge skins" option is checked - and we should document this behavior. In fact, the user can disable skin backups when installing an rmskin if they so choose, which also would make the "Variables files" option not work as well. This isn't really documented either.


I also wanted to mention that you might not be using the "Merge skins" option correctly. This option is really meant to make small patches to your skin after it has been released....like if you missed an important file like an image, or you want to add a small enhancement. This option is not meant to replace entire skins or skin suites.

-Brian
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: Variables getting overwritten on install even though Variable file added to package installer

Post by SilverAzide »

Thanks Brian! Hope you and your family are all well!
Gadgets Wiki GitHub More Gadgets...
User avatar
mpurses
Posts: 15
Joined: May 12th, 2020, 6:17 pm

Re: Variables getting overwritten on install even though Variable file added to package installer

Post by mpurses »

Gotcha, Thanks Brian. I think I understand what I need to do now.

The goal in my skin is to basically have a more advanced Layout feature. So a user can switch between highly modified versions of my skin based on whatever customizations they make(not just the skin layout locations). I can change my initial implementation of saving variables to just writing to a set of pre-existing dummy variable files, instead of creating new ones on the fly. Just won't be able to save preview images.

Could I request a small feature though? I don't use the 'Include current wallpaper' feature, I bypass it and save the wallpaper file separately right now because Rainmeter doesn't save the fit. So it would be great if applying a layout w/ wallpaper applies the saved fit as well.

I get the fit through these measures:

Code: Select all

[WallpaperFit]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Control Panel\Desktop
RegValue=WallpaperStyle

[WallpaperTile]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Control Panel\Desktop
RegValue=TileWallpaper
And apply the number data gotten from the Registry via lua:

Code: Select all

if setwallpaper then 
	wall = '#@#Presets\\Preset\\Wallpapers\\'..name..'-Wallpaper.bmp'
	wallfitnum = SKIN:GetMeasure('WallpaperFit'):GetStringValue() 
	wallfittile = SKIN:GetMeasure('WallpaperTile'):GetStringValue() 
	if wallfitnum == '10' then 
	wallfit = 'Fill'
	elseif wallfitnum == '6' then
	wallfit = 'Fit'
	elseif wallfitnum == '2' then
	wallfit = 'Stretch'
	elseif wallfitnum == '0' and wallfittile == '1' then
	wallfit = 'Tile'
	elseif wallfitnum == '0' and wallfittile == '0' then
	wallfit = 'Center'
	elseif wallfitnum == '22' then
	wallfit = 'Span'
	end
else 
	wall = 'none' 
	wallfit = 'none'
end
Untitled.png
Untitled2.png
Thanks for your work and help Brian!
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Variables getting overwritten on install even though Variable file added to package installer

Post by Yincognito »

mpurses wrote: January 21st, 2021, 8:56 pmI can change my initial implementation of saving variables to just writing to a set of pre-existing dummy variable files, instead of creating new ones on the fly. Just won't be able to save preview images.
I'll let Brian answer your reply regarding the feature suggestion when he can, I just want to make you aware that according to the manual and to the best of my understanding, it seems you can "exclude" files in your root config folder from being overwritten by the skin packager by chaging their attributes to hidden. Not sure if it's suitable or desirable in your case, but I just thought you might want to try this option as well, at least to see if and how it works in your scenario.

I also believe you can create those variable files on the fly by using PowerShell, like I explained in the thread Brian mentioned earlier.

Just trying to give you more avenues of doing what you want. If your variant already works well there's no need to go for any of the above, other than to try and see what works, of course.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth