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
- :
- Built-in function to check for valid file/folder name?
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
Oct 29, 2010
04:53 AM
Built-in function to check for valid file/folder name?
I'm asking this question to make sure I'm not reinventing the wheel.
In a dialog of my setup, users are asked to enter a string which will be used to create a subfolder's name later. Is there any built-in function to check if the string contains valid characters for folder name? You know, eg * > / are not allowed in a folder's name.
Well, I've looked through string functions and file/folder functions and can't find any. All I could make up so far is this:
Is(VALID_PATH, WINDISK ^ szDir)
where szDir contains the string to check.
Is there any case where this could fail to check the validity of folder name?
In a dialog of my setup, users are asked to enter a string which will be used to create a subfolder's name later. Is there any built-in function to check if the string contains valid characters for folder name? You know, eg * > / are not allowed in a folder's name.
Well, I've looked through string functions and file/folder functions and can't find any. All I could make up so far is this:
Is(VALID_PATH, WINDISK ^ szDir)
where szDir contains the string to check.
Is there any case where this could fail to check the validity of folder name?
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Oct 29, 2010
09:39 AM
I do almost the exact same thing to specify (and create if necessary) a transfer folder on a project and it works fine. I also trap the CreateDir call for error conditions just in case though.
If you wanted to be really paranoid couldn't you do a series of 'StrReplace' calls for each invalid character to just remove them all? There arn't that many (http://support.microsoft.com/kb/909264).
If you wanted to be really paranoid couldn't you do a series of 'StrReplace' calls for each invalid character to just remove them all? There arn't that many (http://support.microsoft.com/kb/909264).