walle
2005-11-21 10:11:36 UTC
Hi!
In my program the user is able to make a name of their current profile. After the user has entered at profilename the program creates a directory to store log-files and datafiles for this profile there. But i ran in to problems when one of my users tried to create a profile ending with "." (dot character). I then tested the "new directory" function and realized that it returns an errorcode 1 when i make a directory like "c:\temp\testdir."
The user is not aware that his profile is stored under a directory and he writes the name in a string control.
It's allowed to use dots inside a name, but not in the end. I tried the "not a path" function... but it doesen't work.
By the way.... I'm able to create a folder in windows explorer with a dot at the end.... but it renames it automatically and removes the dot.
My question is!
Is there any good solution in checking if a string/path is built up with legal characters ?
I could restrict the use of certain characters... but . is allowed inside the name... but not in the end ? hmmm......
Best Regards
Marcus
In my program the user is able to make a name of their current profile. After the user has entered at profilename the program creates a directory to store log-files and datafiles for this profile there. But i ran in to problems when one of my users tried to create a profile ending with "." (dot character). I then tested the "new directory" function and realized that it returns an errorcode 1 when i make a directory like "c:\temp\testdir."
The user is not aware that his profile is stored under a directory and he writes the name in a string control.
It's allowed to use dots inside a name, but not in the end. I tried the "not a path" function... but it doesen't work.
By the way.... I'm able to create a folder in windows explorer with a dot at the end.... but it renames it automatically and removes the dot.
My question is!
Is there any good solution in checking if a string/path is built up with legal characters ?
I could restrict the use of certain characters... but . is allowed inside the name... but not in the end ? hmmm......
Best Regards
Marcus