// This can only happen after ApplicationName is set. private static void InitializePaths() { ApplicationCache = Path.Combine(XdgBaseDirectorySpec.GetUserDirectory( "XDG_CACHE_HOME", ".cache"), UserApplicationName); ApplicationData = Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData), UserApplicationName); if (!Directory.Exists(ApplicationData)) { Directory.CreateDirectory(ApplicationData); } }
public static string GetXdgDirectoryUnderHome(string key, string fallback) { string xdg_dir = XdgBaseDirectorySpec.GetUserDirectory(key, fallback); string home_dir = Environment.GetFolderPath(Environment.SpecialFolder.Personal); if (xdg_dir == null || xdg_dir == home_dir || !xdg_dir.StartsWith(home_dir)) { xdg_dir = Path.Combine(home_dir, fallback); } return(xdg_dir); }