Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify where to place additionalResources #435

Open
2 of 5 tasks
dagkodingentur opened this issue Oct 23, 2024 · 1 comment
Open
2 of 5 tasks

Specify where to place additionalResources #435

dagkodingentur opened this issue Oct 23, 2024 · 1 comment
Labels
feedback Waiting for feedback

Comments

@dagkodingentur
Copy link

dagkodingentur commented Oct 23, 2024

I'm submitting a…

  • bug report
  • feature request
  • other

Short description of the issue/suggestion:

I would love if I could specify target directory for additionalResources when creating an installer.

  additionalResources += [
                from: file('game.cfg'),
                into: System.getProperty("user.home") + "/.SaveGame/game.cfg"
        ]

What is the expected behavior?

This would place the file game.cfg in the users home directory under .SaveGame/game.cfg

What is the current behavior?

additionalResources = [ from: file('game.cfg') ]
The resource is copied as expected, but it is placed in the working directory instead of the user's home directory

What is the motivation / use case for changing the behavior?

If the application tries to access a file in 'Program Files', which is the default install location on Windows, administrator privileges is required to read the file. This means that the user has to right click the .exe file and choose 'Run as administrator' if you have an application that tries to read this game.cfg file residing in the install directory, which is undesirable.

I realise that I can specify 'administratorRequired=true' but this is undesirable for obvious reasons.

Please tell us about your environment:

  • JavaPackager version: 1.7.6
  • OS version: Windows 10
  • JDK version: Not relevant
  • Build tool:
    • Maven
    • Gradle
@fvarrui
Copy link
Owner

fvarrui commented Oct 23, 2024

Hi @dagkodingentur!
I think that it can be managed by your app at startup time. You just have to include your game.cfg as a resource in your app; then, when your app starts, checks if $home/.SaveGame/game.cfg exists. If it doesn't, just creates .SaveGame folder and copies your default config file game.cfg from resource into the brand new folder.
This is how I use to do it.
I hope it helps!

@fvarrui fvarrui added the feedback Waiting for feedback label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback Waiting for feedback
Projects
None yet
Development

No branches or pull requests

2 participants