Old 7th January 2013, 13:09   #1
Junior Member
Join Date: Jan 2013
Posts: 2
Folder is not created when running from shortcut

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:

|--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.
joeyo is offline   Reply With Quote
Old 7th January 2013, 14:27   #2
Major Dude
Join Date: Oct 2006
Posts: 1,892
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.
MSG is offline   Reply With Quote
Old 11th January 2013, 05:16   #3
Junior Member
Join Date: Jan 2013
Posts: 2
Thumbs up Problem solved!

The problem is with my Java code. When I start the application from Shortcuts, the code
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.
joeyo is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump