diff options
Diffstat (limited to 'drivers/windows')
-rw-r--r-- | drivers/windows/dir_access_windows.cpp | 29 | ||||
-rw-r--r-- | drivers/windows/dir_access_windows.h | 3 | ||||
-rw-r--r-- | drivers/windows/thread_windows.cpp | 11 |
3 files changed, 36 insertions, 7 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index c20f707684..c32e063736 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -346,6 +346,35 @@ size_t DirAccessWindows::get_space_left() { return (size_t)bytes; } +String DirAccessWindows::get_filesystem_type() const { + String path = fix_path(const_cast<DirAccessWindows*>(this)->get_current_dir()); + print_line("fixed path: "+path); + int unit_end = path.find(":"); + ERR_FAIL_COND_V(unit_end==-1,String()); + String unit = path.substr(0,unit_end+1) + "\\"; + print_line("unit: "+unit); + + TCHAR szVolumeName[100] = ""; + TCHAR szFileSystemName[10] = ""; + DWORD dwSerialNumber = 0; + DWORD dwMaxFileNameLength = 0; + DWORD dwFileSystemFlags = 0; + + if(::GetVolumeInformation(unit.utf8().get_data(), + szVolumeName, + sizeof(szVolumeName), + &dwSerialNumber, + &dwMaxFileNameLength, + &dwFileSystemFlags, + szFileSystemName, + sizeof(szFileSystemName)) == TRUE) { + + return String(szFileSystemName); + } + + ERR_FAIL_V(""); +} + DirAccessWindows::DirAccessWindows() { p = memnew(DirAccessWindowsPrivate); diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h index 2e2d23f4e2..b8599d5c26 100644 --- a/drivers/windows/dir_access_windows.h +++ b/drivers/windows/dir_access_windows.h @@ -82,6 +82,9 @@ public: //virtual FileType get_file_type() const; size_t get_space_left(); + virtual String get_filesystem_type() const; + + DirAccessWindows(); ~DirAccessWindows(); }; diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp index 1bcd5a10d4..8a2992e0c2 100644 --- a/drivers/windows/thread_windows.cpp +++ b/drivers/windows/thread_windows.cpp @@ -52,6 +52,7 @@ DWORD ThreadWindows::thread_callback(LPVOID userdata) { t->id = (ID)GetCurrentThreadId(); // must implement t->callback(t->user); + SetEvent(t->handle); ScriptServer::thread_exit(); @@ -63,13 +64,9 @@ Thread *ThreadWindows::create_func_windows(ThreadCreateCallback p_callback, void ThreadWindows *tr = memnew(ThreadWindows); tr->callback = p_callback; tr->user = p_user; - tr->handle = CreateThread( - NULL, // default security attributes - 0, // use default stack size - thread_callback, // thread function name - tr, // argument to thread function - 0, // use default creation flags - NULL); // returns the thread identifier + tr->handle = CreateEvent(NULL, TRUE, FALSE, NULL); + + QueueUserWorkItem(thread_callback, tr, WT_EXECUTELONGFUNCTION); return tr; } |