public string GetFolderPath(EtoSpecialFolder folder) { NSSearchPathDirectory dir; NSSearchPathDomain domain; Convert (folder, out dir, out domain); return NSSearchPath.GetDirectories (dir, domain, true).FirstOrDefault (); }
public string GetFolderPath(EtoSpecialFolder folder) { NSSearchPathDirectory dir; NSSearchPathDomain domain; switch (folder) { case EtoSpecialFolder.ApplicationResources: return(NSBundle.MainBundle.ResourcePath); case EtoSpecialFolder.ApplicationSettings: Convert(folder, out dir, out domain); var path = NSSearchPath.GetDirectories(dir, domain).FirstOrDefault(); path = System.IO.Path.Combine(path, NSBundle.MainBundle.BundleIdentifier); if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } return(path); default: Convert(folder, out dir, out domain); return(NSSearchPath.GetDirectories(dir, domain).FirstOrDefault()); } }
Environment.SpecialFolder Convert(EtoSpecialFolder folder) { switch (folder) { case EtoSpecialFolder.ApplicationSettings: return Environment.SpecialFolder.ApplicationData; case EtoSpecialFolder.Documents: return Environment.SpecialFolder.MyDocuments; default: throw new NotSupportedException(); } }
public string GetFolderPath (EtoSpecialFolder folder) { switch (folder) { case EtoSpecialFolder.ApplicationResources: return Path.GetDirectoryName (Assembly.GetEntryAssembly ().Location); default: return Environment.GetFolderPath (Convert (folder)); } }
public string GetFolderPath (EtoSpecialFolder folder) { NSSearchPathDirectory dir; NSSearchPathDomain domain; Convert (folder, out dir, out domain); var manager = new NSFileManager(); NSError error; var path = manager.GetUrl(dir, domain, null, false, out error); return path.Path; }
public string GetFolderPath(EtoSpecialFolder folder) { switch (folder) { case EtoSpecialFolder.ApplicationResources: return(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); default: return(Environment.GetFolderPath(Convert(folder))); } }
public string GetFolderPath (EtoSpecialFolder folder) { switch (folder) { case EtoSpecialFolder.ApplicationResources: return NSBundle.MainBundle.ResourcePath; default: NSSearchPathDirectory dir; NSSearchPathDomain domain; Convert (folder, out dir, out domain); return NSSearchPath.GetDirectories (dir, domain, true).FirstOrDefault (); } }
public string GetFolderPath(EtoSpecialFolder folder) { string homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); switch (folder) { // Currently has a bug on dotnet where it returns the wrong path for Mac // https://github.com/dotnet/runtime/issues/63214#issuecomment-1003414322 case EtoSpecialFolder.ApplicationSettings: if (UseXDG && EtoEnvironment.Platform.IsMac) { return(Path.Combine(homeDir, "Library", "Application Support")); } return(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); case EtoSpecialFolder.ApplicationResources: return(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); case EtoSpecialFolder.EntryExecutable: var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); if (String.IsNullOrEmpty(path)) { path = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); } return(path); // Currently has a bug on dotnet, where it returns the wrong path for Linux+Mac // See link above case EtoSpecialFolder.Documents: if (UseXDG && EtoEnvironment.Platform.IsMac) { return(Path.Combine(homeDir, "Documents")); } if (UseXDG && EtoEnvironment.Platform.IsLinux) { return(GetXdgUserDirectory(homeDir, "XDG_DOCUMENTS_DIR", "Documents")); } return(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); case EtoSpecialFolder.Downloads: if (UseXDG && EtoEnvironment.Platform.IsLinux) { return(GetXdgUserDirectory(homeDir, "XDG_DOWNLOAD_DIR", "Downloads")); } // This technically doesn't return the proper download path for Windows on UseXDG, but it's not really a priority to implement. // If someone wants to implement this to call SHGetFolderPath on Windows, feel free to PR. return(Path.Combine(homeDir, "Downloads")); default: throw new NotSupportedException(); } }
public string GetFolderPath(EtoSpecialFolder folder) { NSSearchPathDirectory dir; NSSearchPathDomain domain; Convert(folder, out dir, out domain); var manager = new NSFileManager(); NSError error; var path = manager.GetUrl(dir, domain, null, false, out error); return(path.Path); }
static Environment.SpecialFolder Convert(EtoSpecialFolder folder) { switch (folder) { case EtoSpecialFolder.ApplicationSettings: return(Environment.SpecialFolder.ApplicationData); case EtoSpecialFolder.Documents: return(Environment.SpecialFolder.MyDocuments); default: throw new NotSupportedException(); } }
public string GetFolderPath(EtoSpecialFolder folder) { switch (folder) { case EtoSpecialFolder.ApplicationResources: case EtoSpecialFolder.EntryExecutable: return(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); case EtoSpecialFolder.Downloads: return(Microsoft.WindowsAPICodePack.Shell.KnownFolders.Downloads.Path); default: return(Environment.GetFolderPath(Convert(folder))); } }
public string GetFolderPath(EtoSpecialFolder folder) { #if TODO_XAML switch (folder) { case EtoSpecialFolder.ApplicationResources: return(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); default: return(Environment.GetFolderPath(Convert(folder))); } #else throw new NotImplementedException(); #endif }
void Convert (EtoSpecialFolder folder, out NSSearchPathDirectory dir, out NSSearchPathDomain domain) { switch (folder) { case EtoSpecialFolder.ApplicationSettings: dir = NSSearchPathDirectory.ApplicationSupportDirectory; domain = NSSearchPathDomain.User; break; case EtoSpecialFolder.Documents: dir = NSSearchPathDirectory.DocumentDirectory; domain = NSSearchPathDomain.User; break; default: throw new NotSupportedException (); } }
void Convert(EtoSpecialFolder folder, out NSSearchPathDirectory dir, out NSSearchPathDomain domain) { switch (folder) { case EtoSpecialFolder.ApplicationSettings: dir = NSSearchPathDirectory.ApplicationSupportDirectory; domain = NSSearchPathDomain.User; break; case EtoSpecialFolder.Documents: dir = NSSearchPathDirectory.DocumentDirectory; domain = NSSearchPathDomain.User; break; default: throw new NotSupportedException(); } }
public string GetFolderPath (EtoSpecialFolder folder) { NSSearchPathDirectory dir; NSSearchPathDomain domain; switch (folder) { case EtoSpecialFolder.ApplicationResources: return NSBundle.MainBundle.ResourcePath; case EtoSpecialFolder.ApplicationSettings: Convert (folder, out dir, out domain); var path = NSSearchPath.GetDirectories (dir, domain, true).FirstOrDefault (); path = System.IO.Path.Combine (path, NSBundle.MainBundle.BundleIdentifier); if (!System.IO.Directory.Exists (path)) System.IO.Directory.CreateDirectory (path); return path; default: Convert (folder, out dir, out domain); return NSSearchPath.GetDirectories (dir, domain, true).FirstOrDefault (); } }
public string GetFolderPath(EtoSpecialFolder folder) { switch (folder) { case EtoSpecialFolder.ApplicationResources: return(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); case EtoSpecialFolder.EntryExecutable: { var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); if (string.IsNullOrEmpty(path)) { path = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); } return(path); } default: return(Environment.GetFolderPath(Convert(folder))); } }
public string GetFolderPath(EtoSpecialFolder folder) { NSSearchPathDirectory dir; NSSearchPathDomain domain; switch (folder) { case EtoSpecialFolder.ApplicationResources: return(NSBundle.MainBundle.ResourcePath); case EtoSpecialFolder.EntryExecutable: { var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); if (string.IsNullOrEmpty(path)) { path = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); } return(path); } case EtoSpecialFolder.ApplicationSettings: { Convert(folder, out dir, out domain); var path = NSSearchPath.GetDirectories(dir, domain).FirstOrDefault(); path = Path.Combine(path, NSBundle.MainBundle.BundleIdentifier); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } return(path); } default: Convert(folder, out dir, out domain); return(NSSearchPath.GetDirectories(dir, domain).FirstOrDefault()); } }
/// <summary> /// Gets the folder path for the specified special folder /// </summary> /// <param name="g">Generator to use</param> /// <param name="folder">Special folder to retrieve the path for</param> /// <returns>Path of the specified folder</returns> public static string GetFolderPath (Generator g, EtoSpecialFolder folder) { var handler = g.CreateHandler<IEtoEnvironment>(); return handler.GetFolderPath(folder); }
/// <summary> /// Gets the folder path for the specified special folder /// </summary> /// <param name="g">Generator to use</param> /// <param name="folder">Special folder to retrieve the path for</param> /// <returns>Path of the specified folder</returns> public static string GetFolderPath(Generator g, EtoSpecialFolder folder) { var handler = g.CreateHandler <IEtoEnvironment>(); return(handler.GetFolderPath(folder)); }
/// <summary> /// Gets the folder path for the specified special folder /// </summary> /// <param name="folder">Special folder to retrieve the path for</param> /// <returns>Path of the specified folder</returns> public static string GetFolderPath(EtoSpecialFolder folder) { return(GetFolderPath(Generator.Current, folder)); }
/// <summary> /// Gets the folder path for the specified special folder /// </summary> /// <param name="folder">Special folder to retrieve the path for</param> /// <param name="generator">Generator to get the folder path with</param> /// <returns>Path of the specified folder</returns> public static string GetFolderPath(EtoSpecialFolder folder, Generator generator = null) { var handler = generator.CreateShared <IEtoEnvironment> (); return(handler.GetFolderPath(folder)); }
public static string GetFolderPath(Generator g, EtoSpecialFolder folder) { return(GetFolderPath(folder, g)); }
/// <summary> /// Gets the folder path for the specified special folder /// </summary> /// <param name="folder">Special folder to retrieve the path for</param> /// <returns>Path of the specified folder</returns> public static string GetFolderPath(EtoSpecialFolder folder) { var handler = Eto.Platform.Instance.CreateShared<IHandler>(); return handler.GetFolderPath(folder); }
public string GetFolderPath(EtoSpecialFolder folder) { return Environment.GetFolderPath(Convert(folder)); }
public static string GetFolderPath (Generator g, EtoSpecialFolder folder) { return GetFolderPath (folder, g); }
public static string GetFolderPath(EtoSpecialFolder folder, Generator generator) { var handler = generator.CreateShared <IHandler>(); return(handler.GetFolderPath(folder)); }
/// <summary> /// Gets the folder path for the specified special folder /// </summary> /// <param name="folder">Special folder to retrieve the path for</param> /// <returns>Path of the specified folder</returns> public static string GetFolderPath (EtoSpecialFolder folder) { return GetFolderPath(Generator.Current, folder); }
/// <summary> /// Gets the folder path for the specified special folder /// </summary> /// <param name="folder">Special folder to retrieve the path for</param> /// <param name="generator">Generator to get the folder path with</param> /// <returns>Path of the specified folder</returns> public static string GetFolderPath (EtoSpecialFolder folder, Generator generator = null) { var handler = generator.CreateShared<IEtoEnvironment> (); return handler.GetFolderPath (folder); }
/// <summary> /// Gets the folder path for the specified special folder /// </summary> /// <param name="folder">Special folder to retrieve the path for</param> /// <returns>Path of the specified folder</returns> public static string GetFolderPath(EtoSpecialFolder folder) { var handler = Eto.Platform.Instance.CreateShared <IHandler>(); return(handler.GetFolderPath(folder)); }