Bug 196075 - On Windows - move default userdir to AppData and cachedir to Local AppData
On Windows - move default userdir to AppData and cachedir to Local AppData
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Launchers&CLI
7.0
PC Windows XP
: P2 with 4 votes (vote)
: 7.2
Assigned To: Jiri Rechtacek
issues@platform
http://wiki.netbeans.org/UserdirAndCa...
: API, API_REVIEW_FAST, PLAN
: 168443 (view as bug list)
Depends on: 57798 207501 207502 207503 207505
Blocks: 49813 201334 207506 207507 207816
  Show dependency treegraph
 
Reported: 2011-02-28 01:31 UTC by ulfzibis
Modified: 2012-05-01 06:43 UTC (History)
11 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Current wording for userdir checkbox (12.01 KB, image/jpeg)
2011-08-25 14:04 UTC, Yulia Novozhilova
Details
a part of proposed change in implantation (3.88 KB, patch)
2012-01-19 16:20 UTC, Jiri Rechtacek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ulfzibis 2011-02-28 01:31:28 UTC
[ JDK VERSION : 1.6.22 ]

Ideally, the application data should be stored in the 'Application Data'
subfolder. All programs in Windows put there data there.
The advantage is, that only 1 folder must be backuped each day.

see file: ${NETBEANS_HOME}\NetBeans xxx\etc\netbeans.conf

bad:
netbeans_default_userdir="${HOME}\.netbeans/xxx"

better:
netbeans_default_userdir="${APPDATA}\NetBeans\IDE xxx"
Leaves room for e.g. "${APPDATA}\NetBeans\Profiler xxx"

Following paths should be changed accordingly:
.nbi
.nbprofiler
.netbeans
.netbeans-derby
.netbeans-registration
.netbeans\xx\var
Latter should be excluded from potential backup, so move to:
"${HOME}\Local Settings\Application Data\NetBeans\IDE xxx"

Note: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7022730.
Comment 1 Jesse Glick 2011-07-27 21:43:39 UTC
Bug #57798 deals with the var dir.
Comment 2 Jesse Glick 2011-07-28 17:33:50 UTC
While something may need to be done in the installer as well, e.g. for cobundled software, the main issue is I think in the regular launcher.

ide/launcher/windows/nblauncher.cpp replaces HOME_TOKEN with the "Desktop" registry key. I suppose this should also introduce tokens for Application Data and Local Settings paths, whatever these keys are, and permit these to be replaced as well. (Since this is in native code, 7022730 is irrelevant.) Need to add netbeans_default_cachedir but with no default binding for non-Windows OSs.

To avoid having to create a separate netbeans.conf for Windows, suggest defining netbeans_default_userdir_win32 and netbeans_default_cachedir_win32 as Windows-specific variants read only by netbeans.exe (with the unsuffixed variants still to be used as a fallback).
Comment 3 Jesse Glick 2011-07-29 12:01:17 UTC
(In reply to comment #2)
> should also introduce tokens for Application Data
> and Local Settings paths, whatever these keys are

From bug #57798 comment #25: "AppData" and "Local AppData", or SHGetFolderPath/SHGetKnownFolderPath.
Comment 4 Antonin Nebuzelsky 2011-08-24 12:26:39 UTC
The implementation of issue 57798 now allows to separate var/cache/ part of the userdir into a separate folder (optionally by specifying --cachedir path parameter).

This issue intends to allow new default path for both preferences part of userdir and cache part of userdir on Windows.

So far, on all operating systems including Windows the default userdir path is
"${HOME}/.netbeans/version"
where ${HOME} is the user's home directory

With this change the Windows paths will be:

"${APPDATA}/NetBeans/version" for preferences and
"${LOCALAPPDATA}/NetBeans/version" for caches
where ${APPDATA} and ${LOCALAPPDATA} are the usual Windows "AppData" and "Local AppData" folders in user's home (exact paths will be retrieved by our launcher from windows registry keys for the user)

and on other operating systems the default paths will stay (unchanged) at:

"${HOME}/.netbeans/version" for preferences and
"${HOME}/.netbeans/version/var/cache" for caches
Comment 5 Antonin Nebuzelsky 2011-08-24 13:00:12 UTC
The change will affect NetBeans launchers and also netbeans.conf file.

Because of the change of parameters in netbeans.conf, I am starting this as an API review.

So far, netbeans.conf file contained the following part related to userdir:

# ${HOME} will be replaced by JVM user.home system property
netbeans_default_userdir="${HOME}/.netbeans/version"

(where "version" is actually "dev" for trunk and the version number for releases) 

I am proposing to replace this part with a new one:

# On Windows ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
# with a path to user's "AppData" folder and ${DEFAULT_CACHEDIR_ROOT} with
# a path to user's "Local AppData" folder.
# On other systems ${DEFAULT_USERDIR_ROOT} and ${DEFAULT_CACHEDIR_ROOT}
# will be replaced with a path to <USER HOME>/.netbeans folder.
netbeans_default_userdir="${DEFAULT_USERDIR_ROOT}/version"
netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/version/var/cache"

Please, comment on this change.
Comment 6 nigjo_iqn 2011-08-24 15:16:29 UTC
(In reply to comment #4+#5)
> Please, comment on this change.
Looks good to me.
Comment 7 Jesse Glick 2011-08-24 17:40:06 UTC
(In reply to comment #5)
> # On Windows ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
> # with a path to user's "AppData" folder and ${DEFAULT_CACHEDIR_ROOT} with
> # a path to user's "Local AppData" folder.

Presumably with "\NetBeans" appended.

> # On other systems ${DEFAULT_USERDIR_ROOT} and ${DEFAULT_CACHEDIR_ROOT}
> # will be replaced with a path to <USER HOME>/.netbeans folder.
> netbeans_default_userdir="${DEFAULT_USERDIR_ROOT}/version"
> netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/version/var/cache"

This will not work well - it will pass --cachedir ...\Local Settings\Application Data\NetBeans\7.1\var\cache when --cachedir ...\Local Settings\Application Data\NetBeans\7.1 is wanted.
Comment 8 Jaroslav Tulach 2011-08-25 06:50:28 UTC
(In reply to comment #7)
> This will not work well - it will pass --cachedir ...\Local
> Settings\Application Data\NetBeans\7.1\var\cache when --cachedir ...\Local
> Settings\Application Data\NetBeans\7.1 is wanted.

This is not a complete blocker imho, but if it has to be addressed, then I'd suggest to add yet another default variable:

# On Windows ${DEFAULT_CACHEDIR_SUFFIX} is empty
# on other systems it is "var/cache/"
netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/version/${DEFAULT_CACHEDIR_SUFFIX}"

This is really artificial, but hides all the OS differences into the default variables, otherwise the structure of the conf file remains uncomplicated for those who want to modify it by hand.
Comment 9 Jesse Glick 2011-08-25 11:12:04 UTC
(In reply to comment #8)
> # On Windows ${DEFAULT_CACHEDIR_SUFFIX} is empty
> # on other systems it is "var/cache/"
> netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/version/${DEFAULT_CACHEDIR_SUFFIX}"

One possible approach. Another I suggested before was to define separate netbeans_default_userdir_posix and netbeans_default_cachedir_posix vs. netbeans_default_userdir_windows and netbeans_default_cachedir_windows. Not sure what would be clearest for users.
Comment 10 Yulia Novozhilova 2011-08-25 14:03:57 UTC
From uninstaller point of view: there is one checkbox reserved for userdir removal. I don't think it is a good idea to create another one for cachedir. So 
both folders: "${DEFAULT_USERDIR_ROOT}/version" and "${DEFAULT_CACHEDIR_ROOT}/version" should be deleted at once. 
The correct wording for this checkbox is a question:
- current version is attached
- I would suggest to remove the path to userdir and simplify it to something like:
"NetBeans user folder"
The NetBeans user folder contains the configuration data for the IDE.
For more information about the NetBeans user folder, go to http://wiki.netbeans.org/FaqWhatIsUserdir.

"-" the user may be confused since it is not obvious how to find this "user folder" on her machine, especially without internet
"+" short-spoken and doesn't overload the panel with a lot of information

Maybe Jano has another suggestion? 

Anyway the page http://wiki.netbeans.org/FaqWhatIsUserdir should be updated
Comment 11 Yulia Novozhilova 2011-08-25 14:04:40 UTC
Created attachment 110210 [details]
Current wording for userdir checkbox
Comment 12 Jesse Glick 2011-08-25 14:27:06 UTC
(In reply to comment #10)
> I don't think it is a good idea to create another one for cachedir.

Not sure. It would make sense to me to have a separate checkbox for this (checked by default). At least I would be very nervous about agreeing to delete two unnamed folders.

> http://wiki.netbeans.org/FaqWhatIsUserdir should be updated

Good point. Done.
Comment 13 Yulia Novozhilova 2011-08-25 15:06:59 UTC
> Not sure. It would make sense to me to have a separate checkbox for this
> (checked by default). At least I would be very nervous about agreeing to delete
> two unnamed folders.

That is a good solution, but from the other side in this case the panel will contain 3 checkboxes with quite a long description each. Not very good, the installer is supposed to be simple and quick. What about deleting cache silently in case if userdir is selected? or even in any case?
Comment 14 ulfzibis 2011-08-25 15:11:35 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > This will not work well - it will pass --cachedir ...\Local
> > Settings\Application Data\NetBeans\7.1\var\cache when --cachedir ...\Local
> > Settings\Application Data\NetBeans\7.1 is wanted.
IMO ...\Local Settings\Application Data\NetBeans\cache\7.1 is wanted, so system maintainer would know about the content.
On other systems, having .../var, .../cache side by side instead nested IMO would be better as well, so cache could be easily left out for system backup.

> This is not a complete blocker imho,
+1

(In reply to comment #9)
> netbeans_default_userdir_posix and netbeans_default_cachedir_posix vs.
> netbeans_default_userdir_windows and netbeans_default_cachedir_windows. Not
> sure what would be clearest for users.
Hm, on a Windows machine, ..._posix would be superfluous and vice versa.

I think, the whole path should be assembled by the installer, rather than by the launcher, as same like for "netbeans_jdkhome=", with the possible extra of user interaction _and_ full freedom on later manual screwing.
(On my Ubuntu box I see "/home/.cache/application". so what about netbeans_cachedir="~/.cache/netbeans/version" ?)
So we end up in simply:
netbeans_userdir="~/.netbeans/version"
netbeans_cachedir="~/.cache/netbeans/version" or "~/.netbeans/version/cache"
(don't know why to have '_default_' in the variable name. We don't say 'netbeans_default_jdkhome' either.)

At least, as we have .nbi .nbprofiler .netbeans-derby .netbeans-registration, we additionally could have .netbeans-cache, so posix users would benefit from the strict separation of the cache as well as Windows users do since all time.

(In reply to comment #10)
> I don't think it is a good idea to create another one for cachedir.
It would have some value, to delete the cache, but not the config data on uninstall, but IMO (1) the cache could be deleted without asking or (2) on Windows the whole Locale Settings folder would be cleaned from time to time by the administrator ;-)
BTW. If there are multiple users on a machine using netbeans, does the uninstaller track those multiple userdirs ?
Comment 15 Yulia Novozhilova 2011-08-25 15:26:15 UTC
> (In reply to comment #10)
> > I don't think it is a good idea to create another one for cachedir.
> It would have some value, to delete the cache, but not the config data on
> uninstall, but IMO (1) the cache could be deleted without asking or (2) on
> Windows the whole Locale Settings folder would be cleaned from time to time by
> the administrator ;-)
> BTW. If there are multiple users on a machine using netbeans, does the
> uninstaller track those multiple userdirs ?

No, multiple userdirs are not tracked by the uninstaller. I also trend to delete cache without asking every time the uninstaller is run.
Comment 16 ulfzibis 2011-08-25 15:49:01 UTC
(In reply to comment #14)
> I think, the whole path should be assembled by the installer,
So we could have in netbeans.conf, assem
..on posix machine:
  netbeans_userdir="~/.netbeans/version"
  netbeans_cachedir="~/.cache/netbeans/version" or "~/.netbeans/version/cache"
..on Windows machine:
  netbeans_userdir="%AppData%\Netbeans"\version"
  netbeans_cachedir="%LocalAppData%\Netbeans"\version\cache"

If there is a need to involve the launcher, replace
  ~        | %AppData%       by  ${OS_USERDIR_ROOT}
  ~/.cache | %LocalAppData%  by  ${OS_CACHEDIR_ROOT}
Comment 17 Jesse Glick 2011-08-25 16:40:02 UTC
(In reply to comment #14)
> the whole path should be assembled by the installer, rather than by
> the launcher

Not possible I think - netbeans.conf is shipped in a static ZIP distribution too (not everyone uses the installer).

> netbeans_cachedir="~/.cache/netbeans/version" or "~/.netbeans/version/cache"

Perhaps. We had not considered separating the cache by default on Unix, since there is no standard (that I know of) for "a location in the home dir that should be backed up or shared". (*) If you are willing to specially configure your backup software, then you can freely define the cachedir location to your liking.

If we do define this, ~/.netbeans/cache/version may be best - keeps everything under ~/.netbeans, but ensures that cache is not _inside_ userdir.

> (don't know why to have '_default_' in the variable name. We don't say
> 'netbeans_default_jdkhome' either.)

True, this could probably be dropped. You can override with --userdir/--cachedir on the command line, but the same applies also to --jdkhome.


(*) /var/cache/ (hence by analogy the default location $userdir/var/cache/) serves this function _globally_ but not per user like we need, and is not likely to be writable by non-root anyway. /tmp/cache-$USER or the like would be writable, but is prone to being deleted during a system boot, which may be too often.
Comment 18 ulfzibis 2011-08-25 18:03:16 UTC
(In reply to comment #17)
> (In reply to comment #14)
> > the whole path should be assembled by the installer, rather than by
> > the launcher
> 
> Not possible I think - netbeans.conf is shipped in a static ZIP distribution
> too (not everyone uses the installer).
Not sure contrarily. In my Windows netbeans.conf I have from installer:
  netbeans_jdkhome="C:\Programme\Java\jdk1.6.0_20",
which should not work on Unix ;-)
Anyway, is there a launcher in the static ZIP distribution?
So I'm afraid, ZIP users should live with more or less legacy way using JVM's HOME:
netbeans_userdir="${HOME}/.netbeans/version"
netbeans_cachedir="${HOME}/.cache/netbeans/version"
               or "${HOME}/.netbeans-cache/version"
               or "${HOME}/.netbeans/version/cache"
               or "${HOME}/.netbeans/cache/version"
If there is a launcher, then we could have indeed:
netbeans_userdir="${OS_USERDIR_ROOT}/${NB_USERDIR}/version"
netbeans_cachedir="${OS_CACHEDIR_ROOT}/${NB_CACHEDIR}/version"

> If you are willing to specially configure your backup software,
> then you can freely define the cachedir location to your liking.
Do you receive provision by some backup software vendor ;-)
If the OS_USERDIR_ROOT is not polluted by cache-garbage, a daily (differential/incremental) ZIP would serve all basic needs.
This is one true reason, why people "forget" to backup.

> If we do define this, ~/.netbeans/cache/version may be best - keeps everything
> under ~/.netbeans, but ensures that cache is not _inside_ userdir.
+1 (as basic solution)

BTW: What's about .nbi .nbprofiler .netbeans-derby .netbeans-registration?
Remember Bug 49813 - MS Windows programs do not like dir-names beginning with "."
Comment 19 nigjo_iqn 2011-08-25 18:18:42 UTC
(In reply to comment #18)
> Anyway, is there a launcher in the static ZIP distribution?
Yes. It's the "${APPNAME}.exe" in your "bin" folder. There is a shell "launcher" script, too. The windows launcher translates the "${HOME}" string to the current users profile. It is no problem to parse other variables. (I used it to parse "${MYDOC}" to the users "My Documents" folder)

> BTW: What's about .nbi .nbprofiler .netbeans-derby .netbeans-registration?
> Remember Bug 49813 - MS Windows programs do not like dir-names beginning with
> "."
That's not true. Only the Windows Explorer disallows you to rename a file or folder with a leading ".", because you "missed the file name". It is not a limitation to the file system or in the operating system.

All programs (including MS-Apps) (should) have no problem with that. If so it's a bug in that particular application.
Comment 20 ulfzibis 2011-08-25 18:39:37 UTC
(In reply to comment #19)
> (In reply to comment #18)
> > BTW: What's about .nbi .nbprofiler .netbeans-derby .netbeans-registration?
> > Remember Bug 49813 - MS Windows programs do not like dir-names beginning with
> > "."
> That's not true. Only the Windows Explorer disallows you to rename a file or
> folder with a leading ".", because you "missed the file name". It is not a
> limitation to the file system or in the operating system.
> 
> All programs (including MS-Apps) (should) have no problem with that. If so it's
> a bug in that particular application.
I agree, the wording of Bug 49813 is problematic, it should be better:
On MS Windows don't use unconventional/inconvenient leading-'.'-names.
Comment 21 ulfzibis 2011-08-25 18:41:25 UTC
(In reply to comment #20)
> I agree, the wording of Bug 49813 is problematic, it should be better:
> On MS Windows don't use unconventional/inconvenient leading-'.'-names.
Anyway, those folders should be located in "AppData" sub-folder too.
Comment 22 ulfzibis 2011-08-25 18:58:12 UTC
(In reply to comment #19)
> The windows launcher translates the "${HOME}" string to
> the current users profile. It is no problem to parse other variables. (I used
> it to parse "${MYDOC}" to the users "My Documents" folder)

There is an alternative way from the JRE:
    System.getEnv("APPDATA");
Comment 23 nigjo_iqn 2011-08-25 19:13:21 UTC
(In reply to comment #22)
> (In reply to comment #19)
> > The windows launcher translates the "${HOME}" string to
> > the current users profile. It is no problem to parse other variables. (I used
> > it to parse "${MYDOC}" to the users "My Documents" folder)
> 
> There is an alternative way from the JRE:
>     System.getEnv("APPDATA");
But it not needed. It is much easier to detect this information by the
launcher. The launcher is able to accesss the windows registry, the suggested
way to access these information on Windows. You don't need to do any OS
specific detection in java (which is always a mess)

(And by the way: there is no way to detect "My Documents" via the environment
variables!)


I am very comfortable with the suggestion of Antonin in comment #5. The setting
"netbeans_default_cachedir" from the conf file is replaces by an optional
command line argument "--cachedir". Everything is done in the launcher. Sounds
good to me. No one starts NetBeans or a RCP application without the launcher.
Comment 24 ulfzibis 2011-08-25 20:25:04 UTC
(In reply to comment #23)
Thanks, I would not object. Was just for the record, if it would suit.
BTW, I have a weakness for puristic ways like a double-click on Xyz.jar, which of coarse doesn't matter much here.
Comment 25 Yulia Novozhilova 2011-08-26 10:08:35 UTC
> > There is an alternative way from the JRE:
> >     System.getEnv("APPDATA");
> But it not needed. It is much easier to detect this information by the
> launcher. The launcher is able to accesss the windows registry, the suggested
> way to access these information on Windows. You don't need to do any OS
> specific detection in java (which is always a mess)
> 
> (And by the way: there is no way to detect "My Documents" via the environment
> variables!)
> 

Just FYI, the installer will have to parse these variables anyway (to suggest to remove the userdir while uninstallation), so we can't avoid this OS specific detection in java. I planned to read registry for that purpose.

As for .nbi etc folders, I'm planning to move them to AppData in the near future.
Comment 26 Antonin Nebuzelsky 2011-09-02 17:58:59 UTC
Thanks for all the comments.

I started summarizing the spec for the change at

http://wiki.netbeans.org/UserdirAndCachedirFoldersInSystemSpecificPaths

I decided to do the change properly and prepare carefully all the changes at once. Let's think about the change of the default paths on Linux and Mac as well, not only on Windows.

I don't think the change can be finalized without a risk of issues for 7.1. Let's plan the integration into trunk after 7.1 code-freeze (when 7.1 goes on branch).

In netbeans.conf I still prefer the smallest possible number of variables and not introducing "_windows" and "_posix" (or similar) variables valid only for some operating system. I agree with Jesse that my original proposal above which created .../var/cache folder structure also on Windows was a bit ugly. See the wiki page with a more reasonable approach which separates default locations of preferences and caches into two different paths also on Linux. The question is only if on Linux the cache should be under ~/.netbeans/cache (the one in the writeup currently) or into a different path.

A question to resolve is what should be the new default paths on Mac.

Uninstaller needs to be prepared to also read from Windows Registry. The question about automatic removal of cachedir should be confirmed. I believe it is the right approach.

Autoupdate and Settings modules need to be modified.
Comment 27 Jesse Glick 2011-09-02 18:54:23 UTC
(In reply to comment #26)
> The question is only if on Linux

(or Solaris or other non-Mac POSIXes I guess)

> the cache should be under ~/.netbeans/cache (the one in the
> writeup currently) or into a different path.

Note that a fair number of apps seem to use ~/.cache/$appname: gedit, Chrome, ibus, Totem, etc. etc.

The Linux FHS mentions only /var/cache (not writable by non-root), but says nothing about home directories except that ~/.* may be used for application configuration files.
Comment 28 emi 2011-09-02 18:57:10 UTC
The standard API for Mac paths would be NSSearchPathForDirectoriesInDomains [see 1] which takes a NSSearchPathDirectory [see 2]:

* the cache dir (var/cache) would go in NSCachesDirectory (+ /NetBeans)
* everything else (user dir) under NSApplicationSupportDirectory (+ /NetBeans)

I'd also put:

* configuration (config/ or config/Preferences ?) in NSLibraryDirectory + /Preferences (+ /NetBeans)
* logs (var/log) in NSLibraryDirectory + /Logs (+ /NetBeans)
* spelling stuff in NSLibraryDirectory + /Spelling (+ /NetBeans)

(A native preferences pane is too much to ask, but that would sit in NSPreferencePanesDirectory.)

The Mac launcher will need to be modified to get this data at runtime since these folders are localized on OSX afaik, so only the English version would have ~/Library (for example).

1. http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html
2. http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_DataTypes/Reference/reference.html
Comment 29 Jesse Glick 2011-09-02 18:59:54 UTC
(In reply to comment #28)
> The standard API for Mac paths would be NSSearchPathForDirectoriesInDomains

Can this be accessed somehow from a Bourne shell script so the launcher can use it?

> I'd also put:

Any other kinds of changes would require additions to org.openide.modules.Places.

> these folders are localized on OSX afaik

!
Comment 30 ulfzibis 2011-09-02 20:29:03 UTC
I'm very happy to see, this issue will be resolved in the near future :-)

(In reply to comment #26)
> I agree with Jesse that my original proposal above which
> created .../var/cache folder structure also on Windows was a bit ugly.
But I still think, on Windows,
${DEFAULT_CACHEDIR_ROOT} should be replaced with "<Local AppData>/NetBeans/cache" or
netbeans_cachedir="${DEFAULT_CACHEDIR_ROOT}/cache/version" or
netbeans_cachedir="${DEFAULT_CACHEDIR_ROOT}/version/cache"
would be reasonable, so a system maintainer would be aware about the content.

(In reply to comment #27)
> Note that a fair number of apps seem to use ~/.cache/$appname: gedit, Chrome,
> ibus, Totem, etc. etc.
+1
Comment 31 Jiri Rechtacek 2011-11-10 09:55:57 UTC
*** Bug 168443 has been marked as a duplicate of this bug. ***
Comment 32 Jiri Rechtacek 2012-01-19 16:18:49 UTC
I'm going to integrate the proposed change and place userdir and cachedir to OS specific places. All details information are in http://wiki.netbeans.org/UserdirAndCachedirFoldersInSystemSpecificPaths
In short:
* Windows - <AppData>/NetBeans for userdir, <Local AppData>/NetBeans for cachedir
* Mac - ~/Library/Application Support/NetBeans for userdir, ~/Library/Caches/NetBeans for cachedir
* Linux/Unix/Solaris - ~/.netbeans for userdir, ~/.cache/netbeans for userdir

The rules:
1) if an user runs IDE w/o ant switches, the default places by current OS are set
2) if an user runs IDE with --userdir <my-userdir> option then cachedir will be my-userdir/var/cache - it's important to avoid mix caches between more userdirs
3) if an user specify --cachedir <my-cachedir> this my-cachedir will be used.

Thanks for review.
Comment 33 Jiri Rechtacek 2012-01-19 16:20:47 UTC
Created attachment 115088 [details]
a part of proposed change in implantation

Whole implementation is being developed on installer_196075 branch on http://hg.netbeans.org/core-main
Comment 34 Jiri Rechtacek 2012-01-26 14:09:15 UTC
Thanks. I'm going to integrate it on Tue, Feb 7.
Comment 35 Jiri Rechtacek 2012-01-26 14:10:47 UTC
changes in windows netbeans launcher, a little change in netbeans.conf - core-main/rev/8591746df285
Comment 36 ulfzibis 2012-01-26 14:51:36 UTC
(In reply to comment #35)
> changes in windows netbeans launcher, a little change in netbeans.conf -
> core-main/rev/8591746df285

I'm not sure, why you use plural form for "<Local AppData>/NetBeans/Caches", as all other names are singular, e.g. "<userdir>/var/cache", "~/.cache/netbeans".
See also:
   *NbLauncher::OPT_NB_DEFAULT_CACHE_DIR = "netbeans_default_cachedir=";
   *NbLauncher::DEFAULT_CACHEDIR_ROOT_TOKEN = "${DEFAULT_CACHEDIR_ROOT}";
   *NbLauncher::REG_DEFAULT_CACHEDIR_ROOT = "Local AppData";
vs.
   *NbLauncher::NETBEANS_CACHES_DIRECTORY = "\\NetBeans\\Caches\\";

Little nit: Maybe you could save the unchanged lines 4.1-4.2492 in the patch, if you would insert 1..2 blank lines before line 3.63.
Comment 37 Jiri Rechtacek 2012-02-08 12:06:40 UTC
(In reply to comment #36)
> (In reply to comment #35)
> > changes in windows netbeans launcher, a little change in netbeans.conf -
> > core-main/rev/8591746df285
> 
> I'm not sure, why you use plural form for "<Local AppData>/NetBeans/Caches", as
> all other names are singular, e.g. "<userdir>/var/cache", "~/.cache/netbeans".
Thanks for your review. We changed Caches to Cache on Windows.
Comment 38 Jiri Rechtacek 2012-02-08 12:06:59 UTC
The branch was integrated into core-main/rev/53a620b1f46c
Comment 39 ulfzibis 2012-02-08 12:54:05 UTC
(In reply to comment #37)
> Thanks for your review. We changed Caches to Cache on Windows.
(In reply to comment #38)
> The branch was integrated into core-main/rev/53a620b1f46c

I still see 3 'S'/'s' in:
 5.2 +++ b/ide/launcher/windows/nblauncher.cpp
5.29 +const char *NbLauncher::NETBEANS_CACHES_DIRECTORY = "\\NetBeans\\Caches\\";
 6.2 +++ b/ide/launcher/windows/nblauncher.h
6.26 +    static const char *NETBEANS_CACHES_DIRECTORY;

Anyway, finally I'm happy to see the Windows-friendly paths, thanks for the change.
Comment 40 emi 2012-02-08 17:25:57 UTC
Note (to self): the OSX path names aren't localized per-se, they are just displayed with localization if available (see https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPInternational/Articles/LocalizingPathnames.html and the trick with the ".localized" file/folder).

It wouldn't be bad to add more folders to org.openide.modules.Places, in particular log folder, perhaps Preferences too.
Comment 41 ulfzibis 2012-04-10 15:20:45 UTC
I still see 3 'S'/'s' in:
 5.2 +++ b/ide/launcher/windows/nblauncher.cpp
5.29 +const char *NbLauncher::NETBEANS_CACHES_DIRECTORY =
"\\NetBeans\\Caches\\";
 6.2 +++ b/ide/launcher/windows/nblauncher.h
6.26 +    static const char *NETBEANS_CACHES_DIRECTORY;

Additionally I think, even on Windows you should _not_ use capital 'C', as "...\cache" is in common use.
Comment 42 Jesse Glick 2012-04-10 18:24:11 UTC
ulfzibis - if you have follow-up fixes to suggest, better file them as separate issues blocking this one.
Comment 43 ulfzibis 2012-04-10 20:18:50 UTC
(In reply to comment #42)
> ulfzibis - if you have follow-up fixes to suggest, better file them as separate
> issues blocking this one.

Hm, I still think, the fix here is erroneous/incomplete, as you have the singular forms described in netbeans.conf, but in the real code [1][2] you have plural forms.

The only, that could be seen as follow-up, is my last line in comment 41.

[1] ide/launcher/windows/nblauncher.cpp
[2] ide/launcher/windows/nblauncher.h
Comment 44 Jiri Rechtacek 2012-04-11 07:44:25 UTC
(In reply to comment #41)
> I still see 3 'S'/'s' in:
>  5.2 +++ b/ide/launcher/windows/nblauncher.cpp
> 5.29 +const char *NbLauncher::NETBEANS_CACHES_DIRECTORY =
> "\\NetBeans\\Caches\\";
ulfzibis, you didn't point at up to date version of such file. 'Caches' was replaced by 'Cache' a long time ago. Check out up-to-date sources.

>  6.2 +++ b/ide/launcher/windows/nblauncher.h
> 6.26 +    static const char *NETBEANS_CACHES_DIRECTORY;
Just a variable name.

> Additionally I think, even on Windows you should _not_ use capital 'C', as
> "...\cache" is in common use.
Too late for such change, code is frozen for changes like this. Btw. This implementation was reviewed a lot before merging the implementation and we shouldn't change this minor suggestion now.

As I wrote above, everyone please don't reopen this RFE. All new suggestions file as new RFE. Thanks in advance.
Comment 45 RobertPattinson 2012-05-01 06:43:31 UTC
SPAM - Removed by Administrator


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo