SyMenu Forum

SyMenu

 

HomeTroubleshooting & Bug Reports

If you found a bug post here your report.

Advanced Parameters EnvVar. Messages in this topic - RSS

sl23
sl23
Posts: 285


03/02/2018
sl23
sl23
Posts: 285
I have certain apps set to use portable folders instead of AppData,etc.
An example is ImageLine's MiniHost:
USERPROFILE=.\User
APPDATA=.\User\AppData
ProgramData=.\User\ProgramData
ProgramFiles=.\User\ProgramFiles
HOMEPATH=.\User

The problem I'm having is that this app, and others with similar config's, are creating new folders and settings at the root of the drive instead of using the apps folder to store these.
Is there something wrong with my commands? Perhaps the order is incorrect or something?
I have several apps doing this same thing and I'm getting lots of folders created at the root which is unwanted behaviour.
Is it possible this is a bug?

Thanks for your help.
link
Gianluca
Gianluca
Administrator
Posts: 1274


05/02/2018
Gianluca
Gianluca
Administrator
Posts: 1274
Yes definitely it's a possible bug. Anyway I should analyze some of these apps because your environment variables redefinition seems correct. I suspect these apps don't count on environment variable for the paths resolution.

Can you give me a complete example?
I need:
- a download url to check the same program you are testing;
- a list of all the folder full paths it creates without the env var redefinition
- a list of all the folder full paths it creates with the env var redefinition

To help you understanding which folders the program creates you could use Sysinternals Process Monitor. It gives you all the resources accessed by a certain process.

Thanks
link
sl23
sl23
Posts: 285


05/02/2018
sl23
sl23
Posts: 285
Thanks Gian.
Download here: https://forum.image-line.com/viewtopic.php?f=1919&t=123031
It's an installer. I used UniExtract then SyMenu's EnvVar's to make it portable
I've emailed the xml file containing Process Monitor's report. Unsure what I'm looking for here, sorry.
Is there an app that can save a tree list of files? I have several folders and files created by ILMH which is correctly located within the apps folder as performed via SyMenus EnvVar's.

Even though the AppData/Roaming folder is located in the ILMH/User/AppData folder, it's content is what is being recreated in the root of my drive. Should this EnvVar be changed to:
APPDATA=.\User\AppData\Roaming\
link
sl23
sl23
Posts: 285


05/02/2018
sl23
sl23
Posts: 285
I tried adjusting the EnvVar to:
APPDATA=.\User\AppData\Roaming\

But it had no effect.

I ran the app direct and it created folders in C:/.../AppData/Roaming instead of the root of E:
edited by sl23 on 05/02/2018

It appears that you need to use the syntax above but importantly, create the folder Roaming inside the AppData folder.
So a full path for the variable would be:
IL MiniHost/User/AppData/Roaming

Then it is saved correctly in the location specified in the EnvVar.

edited by sl23 on 05/02/2018
edited by sl23 on 05/02/2018
link
Gianluca
Gianluca
Administrator
Posts: 1274


06/02/2018
Gianluca
Gianluca
Administrator
Posts: 1274
Well I don't understand. Did you solve it?

If the problem is the lacking Roaming folder inside your redefined path, it's easy to workaround it and quite understandable. The puzzling thing is that when the program doesn't find the Roaming folder it writes its files on the drive root. The fall-back folder should be the usual C:/.../AppData/Roaming instead.
Probably it's a program bug.
link
Gianluca
Gianluca
Administrator
Posts: 1274


06/02/2018
Gianluca
Gianluca
Administrator
Posts: 1274
BTW did you already try with the LOCALAPPDATA redefinition?
link
sl23
sl23
Posts: 285


06/02/2018
sl23
sl23
Posts: 285
Sorry, my poor explanation again! Whaaaaa?
Basically, when you specify the EnvVar for APPDATA, as I specified APPDATA=.\User\AppData\Roaming the app looks here but doesn't find the folders. I think this is due to the lack of specifying the \Roaming part of the variable.
Even if it is specified, I've found that you need to actually copy/move/create the directory structure and files into .\User\AppData\Roaming EXACTLY as it would be if using the system AppData\Roaming folder. If it doesn't find an existing folder/file structure in your EnvVar's designated folder, it is then created at the root level of the drive which it is installed on.

I have to admit that most apps that do it are the ones I rarely use. When it does this, I delete the root folders as they aren't necessary for repeated use of the app. I will try to take note of which apps do this from now on if you think it would help you, let me know if this is necessary for you to solve the problem.

Thanks
link
sl23
sl23
Posts: 285


06/02/2018
sl23
sl23
Posts: 285
Gianluca wrote:
BTW did you already try with the LOCALAPPDATA redefinition?

I wasn't sure exactly what the difference was between this and the other APPDATA variable?

I may have used this but cannot find the apps used on. Doesn't it just save the AppData\Local app folders?
Which I couldn't grasp why you had Local but not Roaming? Are these system variables? Isn't Roaming\Appdata a system variable? Should be if Local\Appdata is! Don't understand why it's not included?
link
sl23
sl23
Posts: 285


06/02/2018
sl23
sl23
Posts: 285
Another app, GlaryUtilities, also has errors. Though I suspect it's app related.
Despite setting the EnvVar same as above, Glary refuses to use it and keeps creating new folders in the system AppData\Roaming folder.

All IObit's apps do the same.
edited by sl23 on 06/02/2018
link
Gianluca
Gianluca
Administrator
Posts: 1274


07/02/2018
Gianluca
Gianluca
Administrator
Posts: 1274
Let's go deep to this topic using one of your example.

According to my tests GlaryUtilities has a slightly different behavior than you described.
If you add this environment variable:
APPDATA=.\appdata
it correctly uses the appdata folder inside the program root regardless the appdata folder already exists. In fact if it doesn't exist it creates it and inside it, it creates its own GlarySoft one.
The problem is that it creates that same folder inside the C:\Users[user]\AppData\Local folder too.
I think it's because GlarySoft is not a program but a complete suite of programs. Probably some of them inherit the environment variables from the launcher (which is integrator.exe) others don't.

The general problem is that every program can adopt a different strategy to discover the system folders it needs.
The common strategy they use, is querying the environment variables but which ones?
If a program doesn't query the most obvious environment variables you are screwed.


Examples

I create a program that needs to resolve the folder C:\Users[user]\AppData\Local to write its settings.
The obvious strategy would be to query the env var LOCALAPPDATA.
In this scenario if SyMenu redefines the env var this way, LOCALAPPDATA=.\, the program will be forced to write its own settings right in the program root folder.
Mission accomplished.

But, as a developer, I could use a different strategy and I could query the env var USERPROFILE that resolves the folder C:\Users[user]
Now I can manually add the missing path chunk (AppData\Local) and your previous env var redefinition won't work anymore. You should redefine the USERPROFILE env var but the problem is: how can you know what kind of env var my program is querying?
I could even query for HOMEDRIVE (C:\) and HOMEPATH (\Users[user]) and, I guess, you will never have me.

Beside that scenario consider that some environment variables are read only and can't be redefined.
So if I use the SystemDrive env var I'll get C:\ and you can't redefine it not even if you start crying.


Solution

Forcing a program to be really portable, is not a new problem and we don't need to reinvent the wheel. We already have various portabilizer platforms, such as .paf, x-launcher, yap, LiberKey and others. Every platform works in a very similar way: they tracks the FS and Registry changes a program does and they rollback these changes when the program closes. If a program is not thought to be portable, this is the only way we have to force it.
The SyMenu approach has others purposes and it's not intended to be a perfect portabilizer (for example we lack the entire Registry control).


I hope this can enlighten the topic a bit more, and can explain why certain things don't work in SyMenu. So if you need an unruly program to be portable, please use a real portabilizer platform... and if you like share your work as SPS smile
link
sl23
sl23
Posts: 285


07/02/2018
sl23
sl23
Posts: 285
Interesting explanation, thank you.

I must point out though that Glary does not work that way for me and has never done so on several different PC's with different OS's.
Starnge that it works for you?

Are you doing something I'm not??? lol
link
Gianluca
Gianluca
Administrator
Posts: 1274


07/02/2018
Gianluca
Gianluca
Administrator
Posts: 1274
Well Glary is working differently on two of my PC too... and works differently even if I redefine the env var APPDATA...
I am not the Glary's author and I can't understand how it works so the question is difficult to reply.
link



UGMFree © 2002-2024
PayPal BTC TON