diff options
Diffstat (limited to 'Runtime/Export/Windows/WindowsDirectory.txt')
-rw-r--r-- | Runtime/Export/Windows/WindowsDirectory.txt | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/Runtime/Export/Windows/WindowsDirectory.txt b/Runtime/Export/Windows/WindowsDirectory.txt new file mode 100644 index 0000000..b034279 --- /dev/null +++ b/Runtime/Export/Windows/WindowsDirectory.txt @@ -0,0 +1,86 @@ +C++RAW + +#include "UnityPrefix.h" +#include "Runtime/Mono/MonoManager.h" +#include "Runtime/Scripting/ScriptingUtility.h" +#include "Runtime/Scripting/ScriptingExportUtility.h" +#include "Runtime/Utilities/File.h" + +#if UNITY_EDITOR +#include "Editor/Src/ProjectWizardUtility.h" +#endif + +#if UNITY_METRO +#include "PlatformDependent/MetroPlayer/MetroUtils.h" +#endif + +using namespace Unity; + +using namespace std; + +CSRAW +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using UnityEngineInternal; + +namespace UnityEngine.Windows +{ +CONDITIONAL UNITY_WINRT_API +CLASS Directory + CUSTOM_PROP public static string temporaryFolder + { + #if UNITY_METRO + return scripting_string_new(ConvertStringToUtf8(Windows::Storage::ApplicationData::Current->TemporaryFolder->Path->Data())); + #else + #if UNITY_WP8 + string path = ConvertStringToUtf8(Platform::String::Concat(Windows::Storage::ApplicationData::Current->LocalFolder->Path, L"\\Temp")->Data()); + #else + string path = GetProjectPath() + "/TempState"; + #endif + if (IsDirectoryCreated(path) == false) CreateDirectory(path); + return scripting_string_new(path); + #endif + } + CUSTOM_PROP public static string localFolder + { + #if UNITY_WINRT + return scripting_string_new(ConvertStringToUtf8(Windows::Storage::ApplicationData::Current->LocalFolder->Path->Data())); + #else + string path = GetProjectPath() + "/LocalState"; + if (IsDirectoryCreated(path) == false) CreateDirectory(path); + return scripting_string_new(path); + #endif + } + CUSTOM_PROP public static string roamingFolder + { + #if UNITY_METRO + return scripting_string_new(ConvertStringToUtf8(Windows::Storage::ApplicationData::Current->RoamingFolder->Path->Data())); + #else + #if UNITY_WP8 + string path = ConvertStringToUtf8(Platform::String::Concat(Windows::Storage::ApplicationData::Current->LocalFolder->Path, L"\\Roaming")->Data()); + #else + string path = GetProjectPath() + "/RoamingState"; + #endif + if (IsDirectoryCreated(path) == false) CreateDirectory(path); + return scripting_string_new(path); + #endif + } + CUSTOM public static void CreateDirectory(string path) + { + CreateDirectory(path.AsUTF8()); + } + CUSTOM public static bool Exists(string path) + { + return IsDirectoryCreated(path.AsUTF8()); + } + CUSTOM public static void Delete(string path) + { + if (IsDirectoryCreated(path.AsUTF8())) + DeleteFileOrDirectory(path.AsUTF8()); + } +CSRAW +END + +CSRAW +} |