Archive: Folder is not created when running from shortcut


Folder is not created when running from shortcut
Hi,
I am not sure whether this is a problem with my NSIS script or with Eclipse RCP programming part, still posting here to get some clue on my problem.
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. I am deleting the folder along with the generated html pages, the moment user exits application.

The folder is created at the same level where the exe file is located.
Below is the 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:

   java.lang.String currentPath=System.getProperty("user.dir");
java.io.File folder = new java.io.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.

Is your working dir ('start from' dir) set correctly? It's equal to the value of $INSTDIR at the time the shortcut is created, so you can use SetOutPath to change it.

To debug, let your java app output the exact folder it's trying to create, to a messagebox or something.


Problem solved!
The problem is with my Java code. When I start the application from Shortcuts, the code

System.getProperty("user.dir")
treats the shortcut location as the Install directory. This I checked after printing the directory location in each case i.e while running from exe and from shortcuts.
Thank you MSG for your reply.:)