summaryrefslogtreecommitdiff
path: root/drivers/windows
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/windows')
-rw-r--r--drivers/windows/dir_access_windows.cpp226
-rw-r--r--drivers/windows/dir_access_windows.h4
-rw-r--r--drivers/windows/file_access_windows.cpp2
-rw-r--r--drivers/windows/file_access_windows.h2
-rw-r--r--drivers/windows/mutex_windows.cpp2
-rw-r--r--drivers/windows/mutex_windows.h2
-rw-r--r--drivers/windows/semaphore_windows.cpp2
-rw-r--r--drivers/windows/semaphore_windows.h2
-rw-r--r--drivers/windows/shell_windows.cpp2
-rw-r--r--drivers/windows/shell_windows.h2
-rw-r--r--drivers/windows/thread_windows.cpp2
-rw-r--r--drivers/windows/thread_windows.h2
12 files changed, 77 insertions, 173 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index 4c265a1ab2..a8fed91d94 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -70,21 +70,11 @@ bool DirAccessWindows::list_dir_begin() {
_cisdir=false;
_cishidden=false;
- if (unicode) {
- list_dir_end();
- p->h = FindFirstFileExW((current_dir+"\\*").c_str(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0);
+ list_dir_end();
+ p->h = FindFirstFileExW((current_dir+"\\*").c_str(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0);
- return (p->h==INVALID_HANDLE_VALUE);
- } else {
-
- list_dir_end();
- p->h = FindFirstFileExA((current_dir+"\\*").ascii().get_data(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0);
-
- return (p->h==INVALID_HANDLE_VALUE);
-
- }
+ return (p->h==INVALID_HANDLE_VALUE);
- return false;
}
@@ -93,38 +83,20 @@ String DirAccessWindows::get_next() {
if (p->h==INVALID_HANDLE_VALUE)
return "";
- if (unicode) {
- _cisdir=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
- _cishidden=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN);
+ _cisdir=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+ _cishidden=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN);
- String name=p->fu.cFileName;
-
- if (FindNextFileW(p->h, &p->fu) == 0) {
-
- FindClose(p->h);
- p->h=INVALID_HANDLE_VALUE;
- }
-
- return name;
- } else {
+ String name=p->fu.cFileName;
-#ifndef WINRT_ENABLED
- _cisdir=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
- _cishidden=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN);
+ if (FindNextFileW(p->h, &p->fu) == 0) {
- String name=p->f.cFileName;
-
- if (FindNextFileA(p->h, &p->f) == 0) {
+ FindClose(p->h);
+ p->h=INVALID_HANDLE_VALUE;
+ }
- FindClose(p->h);
- p->h=INVALID_HANDLE_VALUE;
- }
+ return name;
- return name;
-#endif
- return "";
- }
}
bool DirAccessWindows::current_is_dir() const {
@@ -174,63 +146,37 @@ Error DirAccessWindows::change_dir(String p_dir) {
p_dir=fix_path(p_dir);
- if (unicode) {
- wchar_t real_current_dir_name[2048];
- GetCurrentDirectoryW(2048,real_current_dir_name);
- String prev_dir=real_current_dir_name;
+ wchar_t real_current_dir_name[2048];
+ GetCurrentDirectoryW(2048,real_current_dir_name);
+ String prev_dir=real_current_dir_name;
- SetCurrentDirectoryW(current_dir.c_str());
- bool worked=(SetCurrentDirectoryW(p_dir.c_str())!=0);
+ SetCurrentDirectoryW(current_dir.c_str());
+ bool worked=(SetCurrentDirectoryW(p_dir.c_str())!=0);
- String base = _get_root_path();
- if (base!="") {
+ String base = _get_root_path();
+ if (base!="") {
- GetCurrentDirectoryW(2048,real_current_dir_name);
- String new_dir;
- new_dir = String(real_current_dir_name).replace("\\","/");
- if (!new_dir.begins_with(base)) {
- worked=false;
- }
+ GetCurrentDirectoryW(2048,real_current_dir_name);
+ String new_dir;
+ new_dir = String(real_current_dir_name).replace("\\","/");
+ if (!new_dir.begins_with(base)) {
+ worked=false;
}
+ }
- if (worked) {
-
- GetCurrentDirectoryW(2048,real_current_dir_name);
- current_dir=real_current_dir_name; // TODO, utf8 parser
- current_dir=current_dir.replace("\\","/");
-
- } //else {
-
- SetCurrentDirectoryW(prev_dir.c_str());
- //}
-
- return worked?OK:ERR_INVALID_PARAMETER;
- } else {
-
- char real_current_dir_name[2048];
- GetCurrentDirectoryA(2048,real_current_dir_name);
- String prev_dir=real_current_dir_name;
-
- SetCurrentDirectoryA(current_dir.ascii().get_data());
- bool worked=(SetCurrentDirectory(p_dir.ascii().get_data())!=0);
-
- if (worked) {
-
- GetCurrentDirectoryA(2048,real_current_dir_name);
- current_dir=real_current_dir_name; // TODO, utf8 parser
- current_dir=current_dir.replace("\\","/");
-
- }// else {
+ if (worked) {
- SetCurrentDirectoryA(prev_dir.ascii().get_data());
- //}
+ GetCurrentDirectoryW(2048,real_current_dir_name);
+ current_dir=real_current_dir_name; // TODO, utf8 parser
+ current_dir=current_dir.replace("\\","/");
- return worked?OK:ERR_INVALID_PARAMETER;
+ } //else {
- }
+ SetCurrentDirectoryW(prev_dir.c_str());
+ //}
- return OK;
+ return worked?OK:ERR_INVALID_PARAMETER;
#endif
}
@@ -244,36 +190,22 @@ Error DirAccessWindows::make_dir(String p_dir) {
#else
- p_dir=fix_path(p_dir);
+ //p_dir=fix_path(p_dir);
p_dir.replace("/","\\");
bool success;
int err;
- if (unicode) {
- wchar_t real_current_dir_name[2048];
- GetCurrentDirectoryW(2048,real_current_dir_name);
-
- SetCurrentDirectoryW(current_dir.c_str());
-
- success=CreateDirectoryW(p_dir.c_str(), NULL);
- err = GetLastError();
-
- SetCurrentDirectoryW(real_current_dir_name);
-
- } else {
-
- char real_current_dir_name[2048];
- GetCurrentDirectoryA(2048,real_current_dir_name);
+ wchar_t real_current_dir_name[2048];
+ GetCurrentDirectoryW(2048,real_current_dir_name);
- SetCurrentDirectoryA(current_dir.ascii().get_data());
+ SetCurrentDirectoryW(current_dir.c_str());
- success=CreateDirectoryA(p_dir.ascii().get_data(), NULL);
- err = GetLastError();
+ success=CreateDirectoryW(p_dir.c_str(), NULL);
+ err = GetLastError();
- SetCurrentDirectoryA(real_current_dir_name);
- }
+ SetCurrentDirectoryW(real_current_dir_name);
if (success) {
return OK;
@@ -313,7 +245,7 @@ bool DirAccessWindows::file_exists(String p_file) {
GLOBAL_LOCK_FUNCTION
if (!p_file.is_abs_path())
- p_file=get_current_dir()+"/"+p_file;
+ p_file=get_current_dir().plus_file(p_file);
p_file=fix_path(p_file);
@@ -321,73 +253,52 @@ bool DirAccessWindows::file_exists(String p_file) {
WIN32_FILE_ATTRIBUTE_DATA fileInfo;
- if (unicode) {
-
- DWORD fileAttr;
-
- fileAttr = GetFileAttributesExW(p_file.c_str(), GetFileExInfoStandard, &fileInfo);
- if (0 == fileAttr)
- return false;
-
- return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY);
-
- } else {
- DWORD fileAttr;
-
- fileAttr = GetFileAttributesExA(p_file.ascii().get_data(), GetFileExInfoStandard, &fileInfo);
- if (0 == fileAttr)
- return false;
+ DWORD fileAttr;
- return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY);
+ fileAttr = GetFileAttributesExW(p_file.c_str(), GetFileExInfoStandard, &fileInfo);
+ if (0 == fileAttr)
+ return false;
- }
+ return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY);
- return false;
}
bool DirAccessWindows::dir_exists(String p_dir) {
GLOBAL_LOCK_FUNCTION
- if (!p_dir.is_abs_path())
- p_dir=get_current_dir()+"/"+p_dir;
-
- p_dir=fix_path(p_dir);
+ if (p_dir.is_rel_path())
+ p_dir=get_current_dir().plus_file(p_dir);
+ else
+ p_dir=fix_path(p_dir);
p_dir.replace("/","\\");
WIN32_FILE_ATTRIBUTE_DATA fileInfo;
- if (unicode) {
-
- DWORD fileAttr;
- fileAttr = GetFileAttributesExW(p_dir.c_str(), GetFileExInfoStandard, &fileInfo);
- if (0 == fileAttr)
- return false;
+ DWORD fileAttr;
- return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
+ fileAttr = GetFileAttributesExW(p_dir.c_str(), GetFileExInfoStandard, &fileInfo);
+ if (0 == fileAttr)
+ return false;
- } else {
-#ifndef WINRT_ENABLED
- DWORD fileAttr;
-
- fileAttr = GetFileAttributesExA(p_dir.ascii().get_data(), GetFileExInfoStandard, &fileInfo);
- if (0 == fileAttr)
- return false;
-
- return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
+ return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
-#endif
- }
- return false;
}
Error DirAccessWindows::rename(String p_path,String p_new_path) {
- p_path=fix_path(p_path);
- p_new_path=fix_path(p_new_path);
-
+ if (p_path.is_rel_path())
+ p_path=get_current_dir().plus_file(p_path);
+ else
+ p_path=fix_path(p_path);
+
+ if (p_new_path.is_rel_path())
+ p_new_path=get_current_dir().plus_file(p_new_path);
+ else
+ p_new_path=fix_path(p_new_path);
+
if (file_exists(p_new_path)) {
if (remove(p_new_path) != OK) {
return FAILED;
@@ -471,13 +382,6 @@ DirAccessWindows::DirAccessWindows() {
}
}
- unicode=true;
-
-
- /* We are running Windows 95/98/ME, so no unicode allowed */
- if ( SetCurrentDirectoryW ( L"." ) == FALSE && GetLastError () == ERROR_CALL_NOT_IMPLEMENTED )
- unicode=false;
-
change_dir(".");
#endif
}
diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h
index 4a668a7364..384bc8327d 100644
--- a/drivers/windows/dir_access_windows.h
+++ b/drivers/windows/dir_access_windows.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -56,7 +56,7 @@ class DirAccessWindows : public DirAccess {
String current_dir;
- bool unicode;
+
bool _cisdir;
bool _cishidden;
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 19a62967ea..90903f2cbd 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 8f16d66fe1..a2598bfeec 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/drivers/windows/mutex_windows.cpp b/drivers/windows/mutex_windows.cpp
index 3b2004285a..09f8590510 100644
--- a/drivers/windows/mutex_windows.cpp
+++ b/drivers/windows/mutex_windows.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/drivers/windows/mutex_windows.h b/drivers/windows/mutex_windows.h
index 9a3875f053..9447f17a1c 100644
--- a/drivers/windows/mutex_windows.h
+++ b/drivers/windows/mutex_windows.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/drivers/windows/semaphore_windows.cpp b/drivers/windows/semaphore_windows.cpp
index bfd53f9837..50cdf7cce5 100644
--- a/drivers/windows/semaphore_windows.cpp
+++ b/drivers/windows/semaphore_windows.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/drivers/windows/semaphore_windows.h b/drivers/windows/semaphore_windows.h
index f87b868a68..43f6c0b560 100644
--- a/drivers/windows/semaphore_windows.h
+++ b/drivers/windows/semaphore_windows.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/drivers/windows/shell_windows.cpp b/drivers/windows/shell_windows.cpp
index 3994252c48..670f4e483d 100644
--- a/drivers/windows/shell_windows.cpp
+++ b/drivers/windows/shell_windows.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/drivers/windows/shell_windows.h b/drivers/windows/shell_windows.h
index 8bbf51514c..98eae81175 100644
--- a/drivers/windows/shell_windows.h
+++ b/drivers/windows/shell_windows.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp
index 40efa5acd5..6a9e97ba01 100644
--- a/drivers/windows/thread_windows.cpp
+++ b/drivers/windows/thread_windows.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h
index d15e77d065..3c8f92ce57 100644
--- a/drivers/windows/thread_windows.h
+++ b/drivers/windows/thread_windows.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */