Flexera Software Community  

Go Back   Flexera Software Community > Products > Legacy Installer Products > Professional > InstallShield Professional Version 6.x > installshield.is6.general
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-29-2000, 12:00 AM
NewsArchive NewsArchive is offline
Uber User (1000+ Posts)
 
Join Date: Oct 2001
Posts: 44,733
Get Parent Directory?



Hi,

I have a question about how to get the parent directory of a path. Say I

have a path:

C:\Dir1\Dir2\Dir3\

Is there a function that allow me to set the current directory as:

C:\Dir1\Dir2\

Any help will be appreciated.

Yi
  #2  
Old 02-29-2000, 12:00 AM
NewsArchive NewsArchive is offline
Uber User (1000+ Posts)
 
Join Date: Oct 2001
Posts: 44,733
Re: Get Parent Directory?



Yi Zhang wrote in message <38BC2EFE.A12E7927@dataviz.com>...
>Hi,
>
>I have a question about how to get the parent directory of a path. Say I
>
>have a path:
>
>C:\Dir1\Dir2\Dir3\
>
>Is there a function that allow me to set the current directory as:
>
>C:\Dir1\Dir2\

There is no built-in function that does this; but here's the code
for a script-defined function:

function GetParentDir ( szDir, svParentDir )
LIST listDirTree;
NUMBER nListGetString;
STRING svString;
begin
StrRemoveLastSlash ( szDir );
listDirTree = ListCreate ( STRINGLIST );
StrGetTokens ( listDirTree , szDir , "\\" );
if (ListCount ( listDirTree ) <= 1) then
svParentDir = szDir;
else
ListSetIndex ( listDirTree , LISTLAST );
ListDeleteString ( listDirTree );
ListGetFirstString ( listDirTree , svString );
svParentDir = svString;
nListGetString = ListGetNextString ( listDirTree , svString );
while (nListGetString = 0)
svParentDir = svParentDir ^ svString;
nListGetString = ListGetNextString ( listDirTree , svString );
endwhile;
endif;
return 0;
end;

--
Mark
InstallShield Software Corporation


  #3  
Old 02-29-2000, 12:00 AM
NewsArchive NewsArchive is offline
Uber User (1000+ Posts)
 
Join Date: Oct 2001
Posts: 44,733
re:Get Parent Directory?



Mark,

Thank you so much. It worked perfectly!

Yi

Mark at IS wrote:

> Yi Zhang wrote in message <38BC2EFE.A12E7927@dataviz.com>...
> >Hi,
> >
> >I have a question about how to get the parent directory of a path. Say I
> >
> >have a path:
> >
> >C:\Dir1\Dir2\Dir3\
> >
> >Is there a function that allow me to set the current directory as:
> >
> >C:\Dir1\Dir2\
>
> There is no built-in function that does this; but here's the code
> for a script-defined function:
>
> function GetParentDir ( szDir, svParentDir )
> LIST listDirTree;
> NUMBER nListGetString;
> STRING svString;
> begin
> StrRemoveLastSlash ( szDir );
> listDirTree = ListCreate ( STRINGLIST );
> StrGetTokens ( listDirTree , szDir , "\\" );
> if (ListCount ( listDirTree ) <= 1) then
> svParentDir = szDir;
> else
> ListSetIndex ( listDirTree , LISTLAST );
> ListDeleteString ( listDirTree );
> ListGetFirstString ( listDirTree , svString );
> svParentDir = svString;
> nListGetString = ListGetNextString ( listDirTree , svString );
> while (nListGetString = 0)
> svParentDir = svParentDir ^ svString;
> nListGetString = ListGetNextString ( listDirTree , svString );
> endwhile;
> endif;
> return 0;
> end;
>
> --
> Mark
> InstallShield Software Corporation
 


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

vB code is Off
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 11:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© 2010 Flexera Software Inc. All rights reserved.