Currently I am testing my Eclipse RCP appliction for Windows platform ( XP and above).
I am generating HTML pages at runtime. To save these HTML pages I am also creating a folder at runtime.
The folder is created at the same level where the exe file is located. Below is the application directory structure exactly how it looks:
MyApplication
|
|--MyApplication.exe
|--Myapplication.ini
|--artifacts.xml
|--uninstall.exe
|--configuration
|--p2
|--plugins
|--workspace
|--cache (user defined folder)
|
|--system (this is the runtime created folder, generated HTML pages are saved here)
|
|---
This is the code to create the folder at runtime:
String currentPath=System.getProperty("user.dir");
File folder = new File(currentPath+"/cache/system");
This all works fine. Now using NSIS script I have created shortcuts for the ".exe" at two locations- One is on user desktop and other in StartMenu.
The problem is, if I run the application from shortcut, the folder is not created. What should be done to solve this problem?
The script to create the shotcut is:
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\MyApplication.lnk" "$INSTDIR\MyApplication.exe"
CreateShortcut "$DESKTOP\MyApplication.lnk" "$INSTDIR\MyApplication.exe"
Any comments/suggestions/solutions are greatly appreciated.
You should check if the path that you are using for the File
constructor is ok at runtime, with a simple println()
or whatever.
Do you actually call the folder creation? Here you just show what the path is. To create a folder, don't forget to call mkdir()
(or mkdirs()
for a full path).
in the NSIS side: the "working directory" for the shortcut might be wrong. The working directory is set from the current $OUTDIR
when NSIS is processing the CreateShortcut
directive.
To be sure to set the working directory field of a shortcut, you can use the SetOutPath
to force the directory. To use the directory where you install your application, just use $INSTDIR
SetOutPath $INSTDIR