@IWishIKnew The "\\?\" prefix that Disch mentions will allow you to remove your folder. I used the following fragment after my little experiment (see below) 1 2 3 4 5 6 7 8 #define WIN32_LEAN_AND_MEAN #include <windows.h> int main() { RemoveDirectory("\\\\?\\C:\\Tmp\\Hello..."); return 0; } Out of interest, how are you creating the "totoo..." folder in the first place? When I use CreateDirectory with the path "C:\Tmp\Hello...", I just get a folder called "Hello", as Windows assumes I've given it an empty extension. Using the "\\?\" prefix allows me to create the folder, but Explorer really hates it (I'm still using Windows XP at home, and I cannot even see inside the folder). The safest approach would prob. be to escape your program's folder names so the file system doesn't have to deal with any problematic chars. Though you'll need to make sure you only escape the bits you want to, rather than the whole string, so Windows can still understand the folder hierarchy. While you could invent your own scheme, I suggest you base it on the one used used to escape URLs. That is, all problematic chars are replace with % + the hex version of their ASCII or UTF-8 encoding http://en.wikipedia.org/wiki/Url_encoding For a subfolder called "Hello..." in C:\Tmp, that ends up as "C:\Tmp\Hello%2e%2e%2e" in Explorer. If you allow the user to use all prohibited chars as part of their subfolder name, then you'll need to handle at least \/:*?"<>| as well as . and % (as it's used to mark the escaped chars). So over applying it to "C:\Tmp\Hello..." would have ended up with a subfolder called "C%3a%5cTmp%5cHello%2e%2e%2e", probably created in your apps own directory, if you have sufficient access rights. And then your program has to be able to un-escape it, too. Andy |
Please, can you tell me the functions and their arguments for creating, removing, and re-naming folders? PLEASE? Right now I just have my programs write a batch command to do those things (including accidentally making the un-removeable folder). |
BOOL WINAPI CreateDirectory( __in LPCTSTR lpPathName, __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes ); |
lpSecurityAttributes [in, optional] A pointer to a SECURITY_ATTRIBUTES structure. The lpSecurityDescriptor member of the structure specifies a security descriptor for the new directory. If lpSecurityAttributes is NULL, the directory gets a default security descriptor. The ACLs in the default security descriptor for a directory are inherited from its parent directory. |
CreateDirectory(".\\dir1\\sdir");
can not work. I would end up haveing to split it in two. I.E: CreateDirectory(".\\dir1"); CreateDirectory(".\\dir1\\sdir");
|
|
"Boost test - Debug" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping... |