Gnutella Forums

Gnutella Forums (https://www.gnutellaforums.com/)
-   General Discussion (https://www.gnutellaforums.com/general-discussion/)
-   -   please work around this Java bug (https://www.gnutellaforums.com/general-discussion/44579-please-work-around-java-bug.html)

stax September 3rd, 2005 07:10 AM

please work around this Java bug
 
Hi,

I just found Phex and dumped all my other P2P applications, cool. There is however a little problem. Phex determines the directory to save settings using this Java function:

getProperty("user.home")

this method got it all wrong, it reads a reg key to get the desktop dir and return the parent of it. On my system it returns "D:\" and I have a hard time to get along with this. My desktop dir is not within my user dir because I moved it outside, for the Windows world this is unproblematic but only if you don't use any Java applications. I must admit this might sound niggling, I'm trying to organize my files in a well thought out hierarchy.

On Windows the proper way to determine the directory where applications are supposed to save their settings is using the SHGetFolderPath Win32 API function with CSIDL_APPDATA as parameter. There is also a csidl for what a Linux user would understand as home directory (CSIDL_PROFILE) which would have been the correct implementation for getProperty("user.home").

Maybe the easiest way to get this dir with Java is expanding the %APPDATA% environment variable which Java might be capable (I don't know Java, unfortunately).

Imho applications should consider more simplicity, there's nothing easier then doing things the xcopy way but that's a very big story.

Regards,
stax

stax November 30th, 2005 05:02 AM

Nobody replying indicates a little bit windows users aren't really first class citizens here. Quite many people can't get along with applications that don't integrate with the system properly. I did some research for my own application, please read here . Quite a few people were seriously pissed of by applications that behave badly. You are only saving in the home dir when the desktop dir is within the home dir which is often not desirable and even if it's within the home dir you still doing it wrong because applications are not supposed to save in the home dir directly but in a sub dir called application data. The system provides various ways to get the path of application data directory. I live in Weilimdorf btw. :D

Only A Hobo November 30th, 2005 05:38 AM

There have been a lot of changes to Phex since your first post, and GregorK will, no doubt pick up on this post. If he misses it for some reason send him a pm.

As you can see I'm a mac user so this makes little sense to me:)

arne_bab November 30th, 2005 09:41 AM

I'm a Mac-User too, and the main-dev is a bit busy programming sometimes, so please don't gripe it, that he seems to have overlooked your post.

Besides: GregorK is Windows-User, so if you can contribute some ideas how to select the best folders in Windows without too much hassle for Java, I'm sure he'll be quite interested.

GregorK November 30th, 2005 02:16 PM

sorry for missing this thread...

This bug is not very easy to work around... not even at sun it is quite clear what is the best way to determine the correct directory across the different window plattforms.

To store the files in the application directory is also not a very good way when looking at systems used by multiple users.

Actually I currently have no idea how to solve this usefully.

For your problem you can work around by starting Phex with the option:

-c <path>

Copy your existing configuation files to the new location before starting.

stax November 30th, 2005 04:17 PM

Thanks and sorry if I was too much of a pain. I feel much better now and I hope the other Java developers I surely will point to this topic will provide a solution as well. If I ever find a solution (by now I know only Visual Studio languages) I'll report back.


All times are GMT -7. The time now is 03:23 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.