WebFreak001 / FSWatch

A cross-platform folder & file watching library using win32, inotify or std.file
33 stars 8 forks source link

Windows file name with invalid characters #12

Closed jazzbre closed 6 years ago

jazzbre commented 6 years ago

Had to replace: string fileName = (cast(wchar[])(cast(ubyte*) info.FileName)[0 .. info.FileNameLength]).toUTF8.idup; with: wstring wfileName = info.FileName[0 .. info.FileNameLength].idup; string fileName = wfileName.toUTF8.idup; (BTW Formatting got broken on paste).

jazzbre commented 6 years ago

Actually the right way to do this is this it seems: wstring wfileName = info.FileName[0 .. info.FileNameLength / 2].idup; string fileName = wfileName.toUTF8.idup;

WebFreak001 commented 6 years ago

hm that should be the same as the one up there actually. Can you try using the original code making it a void* instead of ubyte*?

jazzbre commented 6 years ago

Hm, reverted the code but it doesn't happen anymore, it's possible it was some other code that save the files wrong. I will investigate this further.