1

I'm storing a preferences file for bundled JavaFX app under user directory, which I create at Runtime using

System.getProperty("user.home")

I want to order InnoSetup to delete that file at uninstall, but I can't find appropriate Inno Constant. Please, advice.

Evgeniy Mishustin
  • 3,343
  • 3
  • 42
  • 81

1 Answers1

1

On Windows, user.home maps to %USERPROFILE% environment variable, what is typically C:\Users\username.

There's no equivalent constant for that in Inno Setup. Probably because you are not supposed to store any files there. You should store your files to C:\Users\username\AppData\Roaming\app (or ...\Local\app). In Inno Setup that is {userappdata}\app (or {localappdata}\app). It Java, you can use System.getenv("APPDATA") (or System.getenv("LOCALAPPDATA")).


Anyway, to answer your question, you can use {%USERPROFILE}.
See also Inno Setup User Home Path.


Also in general, it's a bad idea to try to access a user profile in Inno Setup (un)installer, as the (un)installer can be executed using a different local account (typically Administrator), than the one you are interested in.

This is covered in Installing application for currently logged in user from Inno Setup installer running as Administrator.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • but how can I get "\Local\app" at Java ? Is this location ok to to access from Inno Uninstaller? Great thanks. – Evgeniy Mishustin Oct 10 '17 at 09:20
  • I do not know Java. But I assume you can use `System.getenv("LOCALAPPDATA")` - But any account-specific folder, including `..\Local\app` has the same problem as described in [Installing application for currently logged in user from Inno Setup installer running as Administrator](https://stackoverflow.com/q/44575666/850848) - but that's a different topic. – Martin Prikryl Oct 10 '17 at 09:22