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 }