开发者

QDir and invalid directory names

Using following code I could create directory with name "....;.a" , but such names are not valid on Window systems.

QDir 开发者_运维问答dir(some_folder());
QString invalid_folder = "....;.a";
bool ret = dir.mkdir(invalid_folder);


There's a difference between the directory names that Windows 'supports' (and lets you create using explorer), and those that are actually supported by the file system.

For example, if you try to create a name that starts with a ., Explorer will not permit this; but you can programatically create such names, and many programs do (especially those that also run on *nix variants).


You can use for file names not the following characters:

  < (less than)
    > (greater than)
    : (colon)
    " (double quote)
    / (forward slash)
    \ (backslash)
    | (vertical bar or pipe)
    ? (question mark)
    * (asterisk)

Integer value zero, sometimes referred to as the ASCII NUL character.
Characters whose integer representations are in the range from 1 through 31, except for alternate data streams where these characters are allowed. For more information about file streams, see File Streams.

Any other character that the target file system does not allow.

More info you can find: here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜