This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: LongPathToShortPath in Java?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 08, 2007
02:40 PM
LongPathToShortPath in Java?
Is there a IS11.5 Multiplatform LongPathToShortPath() function?
Thanks,
Bradley
Thanks,
Bradley
(8) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 08, 2007
03:03 PM
It's not an obvious place for it, but the Win32Service interface has a getShortPath method that might do what you want.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 10, 2007
10:13 AM
RobertDickau wrote:
It's not an obvious place for it, but the Win32Service interface has a getShortPath method that might do what you want.
Okay I see the method:
public java.lang.String getShortPath(java.lang.String longPath)
throws com.installshield.wizard.service.ServiceException
I would guess that I would use this in a custom Wizard bean to take the install path and update a property with the short name. I could then use that property to do an ascii update on the files i have to modify.
You wouldn't happen to have a code snip handy showing getshortpath in use would you?
Thanks in anycase,
Bradley
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 10, 2007
11:04 AM
Here's a dusty old wizard action I had lying around; might still work...
import com.installshield.util.*;
import com.installshield.wizard.*;
import com.installshield.wizard.platform.win32.*;
import com.installshield.wizard.service.*;
public class LongPathToShort extends WizardAction
{
private String longPath = "";
// hidden property where value is stored
private String value = "";
public void execute(WizardBeanEvent event)
{
longPath = resolveString(longPath);
try
{
Win32Service ws =
(Win32Service)getService(Win32Service.NAME);
value = ws.getShortPath(longPath);
}
catch (ServiceException se)
{
logEvent(this, Log.ERROR, se);
}
}
public String getLongPath( )
{
return longPath;
}
public void setLongPath(String longPath)
{
this.longPath = longPath;
}
}
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 10, 2007
01:35 PM
RobertDickau wrote:
Here's a dusty old wizard action I had lying around; might still work...
Nice.
So when compile and register this wizard action I add this to my project after the insrtall dir is set. I then pass the long path to the Wizard Action and it modifys the long path to short path and stores it in the string value.
Can I then pass this value as a Java property [$J(ShortPathString) ] back to my installer (to be used later in an ascii file update) by using this code...
...
System.setProperty("ShortPathString", value);
...
public String getShortPathString ()
{
return this.ShortPathString;
}
public void setShortPathString (String ShortPathString)
{
this.ShortPathString = ShortPathString;
}
....
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 10, 2007
01:58 PM
You shouldn't even need to set the Java system property; if you've left it as a wizard action (if I remember correctly), $W(beanid.value) should contain the short string...
But yes, if that doesn't work, your System.setProperty ==> $J(something) trick should work.
But yes, if that doesn't work, your System.setProperty ==> $J(something) trick should work.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 10, 2007
02:52 PM
RobertDickau wrote:
You shouldn't even need to set the Java system property; if you've left it as a wizard action (if I remember correctly), $W(beanid.value) should contain the short string...
But yes, if that doesn't work, your System.setProperty ==> $J(something) trick should work.
Oh. So $W(beanid.valuse) would be the bean id of the wizard action then?
Thanks I will give it a try,
Bradley
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 30, 2007
02:48 PM
RobertDickau wrote:
You shouldn't even need to set the Java system property; if you've left it as a wizard action (if I remember correctly), $W(beanid.value) should contain the short string...
But yes, if that doesn't work, your System.setProperty ==> $J(something) trick should work.
When I used $W(bean.value) ( the actual BeanID=bean) the return value is null and when I used $J(ShortPathString) the value was left out completely (very null.)
Any thoughts?
Bradley
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 30, 2007
03:49 PM
For testing, what if you display the value of the short path using a message dialog (that is, something like javax.swing.JOptionPane)? That will help determine if it's a problem with the service or with your custom bean...
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)