cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
enanrum
Level 9

How to use Short Name paths on windows?

I have to add some files to the location of a directory I get from the registry but I noticed that the path can use the windows shortened path as in:

C:\Sia782\WEBCL~1\BIN\ssceosrv.DLL

I need to put some files in that BIN directory!

Anyone know how I can do that, maybe in a custom action!

The files get installed to the Install directory then I need to copy 2 files to from the install dir to C:\Sia782\WEBCL~1\BIN

Thanks,
Tom
Labels (1)
0 Kudos
(7) Replies
RobertDickau
Flexera Alumni

The Win32Service interface has a getShortPath method that might be of use; searching these forums for getShortPath should turn up an example or two...
0 Kudos
CChong
Level 11 Flexeran
Level 11 Flexeran

You should copy the files to the long pathname, not the short pathname, since technically speaking, the short pathname is not unique (ie its possible that the installer will run on a system where the shortpath name of your desired directory is "C:\Sia782\WEBCL~2\BIN", etc.
0 Kudos
enanrum
Level 9

I think you guys mis-understood my question!

I know I need to copy the files to the Long path name because I tried to copy it to the short name and it didn't work!

The registry entry has the Short Name - how do I get the Long Name from the Short Name?

I've seen the LongPathToShort class on this site and it uses a getShortPath method, I thought there might be a getLongPath method of the win32service but there isn't - at least I couldn't find it!

Is there a way of doing this? Or is there a copy action that can take the short path string?

Thanks,
Tom
0 Kudos
RobertDickau
Flexera Alumni

I haven't tried it for a while: do the file-copy operations not work with a short path?
0 Kudos
enanrum
Level 9

Thanks Robert - didn't even think to try it copy-file operation but it worked!

If anyone cares;

Used a get reg value action;
then in a custom action:

String regpath = arg0.resolveString("$W(REGPATH)");

File f = new File(regpath);
File path = f.getParent();

arg0.getServices().getISDatabase().setVariableValue("REGPATH", path);

set Copy File source = $V(REGPATH)

then used the copy
0 Kudos
RobertDickau
Flexera Alumni

I should leave well enough alone, but how about a no-code version:

$N($W(REGPATH)\..\)

(get the path, add a final backslash to trick it into thinking it's a directory, referring to the parent with ..\, then normalizing it)...?
0 Kudos
enanrum
Level 9

No - thats great because I not only needed to copy files to the Bin dir also to another depending on if it was a siebel client or server!

String siebelServer = arg0.resolveString("$N($W(SIEBEL_PATH.value)/../../webmaster)");
String siebelClient = arg0.resolveString("$N($W(SIEBEL_PATH.value)/../../public/enu)");


Then see which one exists!

Thanks again!
0 Kudos