Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (789)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  writing files as user, privileges  (Read 3180 times)
0 Members and 1 Guest are viewing this topic.
Offline Cero
« Posted 2011-09-07 18:46:32 »

been using windows 7 lately
now I realize that saving savegames and screenshots to a subfolder of my game, which (when deployed) has been installed obviously to c:\program files\game or similar in windows, doesnt really work, because a user shall not save files to C:

can a Java app ask for admin right at start ?

other than that you would just make a folder in the home folder of the user and use that to save any files, right ? - and that works every time ?

Offline cylab

JGO Kernel

Medals: 195

« Reply #1 - Posted 2011-09-07 20:48:39 »

You can use FileSystemView.getFileSystemView().getDefaultDirectory() to get the home/profile directory on different platforms. Doesn't always work from an Applet, though.

Mathias - I Know What [you] Did Last Summer!
Offline Z-Man
« Reply #2 - Posted 2011-09-07 21:00:23 »

System.getProperty("user.home"); should get the user's home directory. As for the permissions I have no idea, but I'd like to know.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #3 - Posted 2011-09-07 21:51:10 »

System.getProperty("user.home"); should get the user's home directory. As for the permissions I have no idea, but I'd like to know.

yea I would create a folder in that directory
question is, is it guaranteed to work ?

Offline philfrei
« Reply #4 - Posted 2011-09-08 00:20:31 »

System.getProperty("user.home"); should get the user's home directory. As for the permissions I have no idea, but I'd like to know.

In terms of permissions, you can get access the client's computer via JNLP. I've done it before with an app that loads and plays .wav files from a client. However, the system steps in and ask the client to give permission. I used the code presented in this tutorial as my model.

But if you want freer access, you will have to look at "Signing".

Lot's to get confused by in that. I remember having troubles with the Keystore (for Signing) but found some useful background in this article:

If you get it all working, I'll probably be back to ask you for advice. I got side-tracked when I was trying to set this up signing and never finished it.  Smiley (I have this topic on "notify," in hopes.)

music and music apps:
Offline Cero
« Reply #5 - Posted 2011-09-08 01:02:40 »

signing jars... yea not what I would wanna do. Also just java apps, no applets or webstarts, that I am interested in.

if making folder und writing files to the System.getProperty("user.home") folder, always succeeds, then it's fine D=

Offline BoBear2681

JGO Coder

Medals: 19

« Reply #6 - Posted 2011-09-08 01:45:29 »

Yes, it should always work for desktop games (not applets); users should always be able to write to their own home directories, and the "user.home" property is guaranteed to be defined.
Offline ra4king

JGO Kernel

Medals: 508
Projects: 3
Exp: 5 years

I'm the King!

« Reply #7 - Posted 2011-09-08 04:02:35 »

No applications of any sort has default write access to "C:\Program Files". You have to have the UAC prompt that allows the program to run with Administrator access.

Pages: [1]
  ignore  |  Print  

hadezbladez (2631 views)
2018-11-16 13:46:03

hadezbladez (949 views)
2018-11-16 13:41:33

hadezbladez (2590 views)
2018-11-16 13:35:35

hadezbladez (510 views)
2018-11-16 13:32:03

EgonOlsen (3744 views)
2018-06-10 19:43:48

EgonOlsen (4140 views)
2018-06-10 19:43:44

EgonOlsen (2496 views)
2018-06-10 19:43:20

DesertCoockie (3304 views)
2018-05-13 18:23:11

nelsongames (3400 views)
2018-04-24 18:15:36

nelsongames (4378 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!