Old 2nd March 2015, 21:29   #1
coderwolf
Junior Member
 
Join Date: Feb 2015
Posts: 25
$InstDir with GetFullPathName /SHORT question

I am at a bit of a loss here. I have the following code:

Quote:
Page directory "" "" fnc_InstDir_AfterShow

Function fnc_InstDir_AfterShow
MessageBox MB_OK "$InstDir"
GetFullPathName /SHORT $CMPC_RootPath_Short $InstDir
MessageBox MB_OK "$CMPC_RootPath_Short"
FunctionEnd
The first MessageBox is showing the $InstDir correctly. I have other "GetFullPathname /SHORT" calls working correctly with other variables using the same syntax . But for some reason, the second MessageBox comes out blank. What am I missing here?
coderwolf is offline   Reply With Quote
Old 2nd March 2015, 22:49   #2
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
Empty string indicates that GetFullPathName has failed. You're probably trying to get a short path for a dir that hasn't been created yet.

PostEnd:
aerDNA is offline   Reply With Quote
Old 3rd March 2015, 07:34   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Short paths should only be used for compatibility with 16-bit programs and buggy applications. Short name generation can be turned off so not every filename will have one...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd March 2015, 11:30   #4
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
You can check for NtfsDisable8dot3NameCreation. It doesn't tell you the state at the time an existing dir was created but it can tell you whether you'll be able to create new short paths. It should only be used when it can't be avoided, that much is for sure.

PostEnd:
aerDNA is offline   Reply With Quote
Old 3rd March 2015, 12:25   #5
coderwolf
Junior Member
 
Join Date: Feb 2015
Posts: 25
Quote:
Originally Posted by Anders View Post
Short paths should only be used for compatibility with 16-bit programs and buggy applications. Short name generation can be turned off so not every filename will have one...
This is an auto-configuration wrapper for a DOS emulation program. I am getting the path in a way that the DOS emulator would know what it is in the main OS(windows 7). This information is (in the installer process) written to its config file as a "mounted" drive.

Quote:
Originally Posted by aerDNA View Post
You can check for NtfsDisable8dot3NameCreation. It doesn't tell you the state at the time an existing dir was created but it can tell you whether you'll be able to create new short paths. It should only be used when it can't be avoided, that much is for sure
As you can see from what my main goal is above, it is unavoidable. After a bit of investigation, under windows 7 "NtfsDisable8dot3NameCreation" is a volume based setting. I have looked at it and it is on for the volume in question. As for your earlier idea about it being a directory that has not been created at that point in time, I will have to investigate that further.

Last edited by coderwolf; 3rd March 2015 at 12:49. Reason: Missed multi-qouting
coderwolf is offline   Reply With Quote
Old 3rd March 2015, 13:42   #6
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
I tried Kernel32::GetVolumeInformation but it always returns 255 for lpMaximumComponentLength, regardless of reg entry. It just tells you if FS supports long names, not if Windows is creating short names, so that's useless. In the end, GetFullPathName /SHORT is as good a check as any. If it fails and you're sure it's an existing path, it means 8.3 creation is disabled. At that point there's not much you can do but inform the user.

PostEnd:

Last edited by aerDNA; 3rd March 2015 at 15:55.
aerDNA is offline   Reply With Quote
Old 3rd March 2015, 18:43   #7
coderwolf
Junior Member
 
Join Date: Feb 2015
Posts: 25
Quote:
Originally Posted by Anders View Post
Short paths should only be used for compatibility with 16-bit programs and buggy applications. Short name generation can be turned off so not every filename will have one...
It appears that the Directory was not created and that was the issue. I added a line before I ran the /short line. After I did that the returned variable was not blank. This is an internally used install file, so I believe I can trust that the machines will have a standard configuration with C drive set to support 8.3 filename format, so I am going to just give it a very basic ${If} Short_Path == "" -> MessageBox structure (as I am not proficient enough with this installer to get that deep atm).
coderwolf is offline   Reply With Quote
Old 3rd March 2015, 19:14   #8
coderwolf
Junior Member
 
Join Date: Feb 2015
Posts: 25
If the path is not set, is there a command to auto "rollback" the installation steps done at that point. Or is my only option to code a rollback using a step by step code at that point?
coderwolf is offline   Reply With Quote
Old 3rd March 2015, 19:17   #9
coderwolf
Junior Member
 
Join Date: Feb 2015
Posts: 25
nm. Sorry, I broke a forum rule. I did not search.
coderwolf is offline   Reply With Quote
Reply
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