Reputation: 177
Below query helps to validate when I keep invalid path. The problem is its failing when I enter " \ " or "." or any special characters. How to validate them?
FILE-INFO:FILENAME = "\".
IF FILE-INFO:FULL-PATHNAME = "?" THEN
MESSAGE "Invalid path".
Upvotes: 0
Views: 696
Reputation: 14020
The "\" is an "escape" character on UNIX so that could certainly be a problem. Either double-escape it as "\\" or alternate-escape it with "~".
Mike's point about ? vs "?" is also spot-on.
In other words:
FILE-INFO:FILENAME = "~\".
IF FILE-INFO:FULL-PATHNAME = ? THEN
MESSAGE "Invalid path".
Also - for portability reasons it is better to use forward slashes as directory separators. They work for either Windows or UNIX whereas backslash will only work if your code runs on Windows.
Upvotes: 3