Hi!
I try to copy a shortcut file into the desktop. I have made a lot of research about this.
On Linux, I check if XDG_DESKTOP_DIR is set and non empty. If not, I check if $HOME/.config/user-dirs.dirs exists; if so, I call “. $HOME/.config/user-dirs.dirs”. Then, I can use System.getenv(“XDG_DESKTOP_DIR”). Using directly XDG_DESKTOP_DIR is enough on GNOME but not on KDE (.config/user-dirs.dirs is useful in this case).
On Mac, I’m not sure $HOME/Desktop works for non English users. Does someone have a better idea? I don’t really know AppleScript…
On Windows, I have found this but there is a missing class StreamReader:
This does not work always:
FileSystemView filesys = FileSystemView.getFileSystemView();
File[] roots = filesys.getRoots();
filesys.getHomeDirectory();
I could use SHGetFolderLocation or SHGetFolderPath APIs but I prefer avoiding native calls. Does someone have a better idea?
The Java Web Start shortcut feature has too much bugs including this one and this other one, I cannot use it. It has never worked reliably on KDE. Thank you very much for your attention.