cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
agshah
Level 7

How to get partial dir structure specified in INSTALLDIR

Jump to solution

Hi,

Say user specified c:\app\foo\bar as the INSTALLDIR to install the product.

In InstallScript, how do I extract c:\app from this ?

thanks.

Labels (1)
0 Kudos
(1) Solution

agshah,

You could write a custom function to accomplish this using StrGetTokens:

https://docs.revenera.com/installshield22helplib/Subsystems/installshield22langref/helplibrary/LangrefStrGetTokens.htm

//example usage: 

svResult = GetRootFolder( svFolderPath );

//--------------------------------------
prototype STRING GetRootFolder( STRING );
function STRING GetRootFolder( szPath )
	LIST	lstPathParts;
	STRING	svDrive, svFolder;
begin

	lstPathParts = ListCreate( STRINGLIST );
	StrGetTokens( lstPathParts, szPath, "\\" );
	
	ListGetFirstString( lstPathParts, svDrive );	// gets the drive
	ListGetNextString (lstPathParts, svFolder);		// gets the root folder
	
	return svDrive ^ svFolder;	// returns the path
end;

HTH

View solution in original post

0 Kudos
(4) Replies
shunt
Revenera Moderator Revenera Moderator
Revenera Moderator
0 Kudos

thanks but ParsePath function does not seem to help with my situation. 

None of the 'nOperation' options, for example, will  return c:\app from c:\app\foo\bar.

Is there anything else that can help with this?

0 Kudos

agshah,

You could write a custom function to accomplish this using StrGetTokens:

https://docs.revenera.com/installshield22helplib/Subsystems/installshield22langref/helplibrary/LangrefStrGetTokens.htm

//example usage: 

svResult = GetRootFolder( svFolderPath );

//--------------------------------------
prototype STRING GetRootFolder( STRING );
function STRING GetRootFolder( szPath )
	LIST	lstPathParts;
	STRING	svDrive, svFolder;
begin

	lstPathParts = ListCreate( STRINGLIST );
	StrGetTokens( lstPathParts, szPath, "\\" );
	
	ListGetFirstString( lstPathParts, svDrive );	// gets the drive
	ListGetNextString (lstPathParts, svFolder);		// gets the root folder
	
	return svDrive ^ svFolder;	// returns the path
end;

HTH

0 Kudos
agshah
Level 7

thanks very much.

0 Kudos