special folders
This commit is contained in:
@ -6,6 +6,7 @@ using System.Net;
|
|||||||
using System.Runtime.Serialization.Json;
|
using System.Runtime.Serialization.Json;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using ZicMoove.Model.Auth.Account;
|
using ZicMoove.Model.Auth.Account;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace ZicMoove.Droid
|
namespace ZicMoove.Droid
|
||||||
{
|
{
|
||||||
@ -13,13 +14,23 @@ namespace ZicMoove.Droid
|
|||||||
public static class YavscHelpers
|
public static class YavscHelpers
|
||||||
{
|
{
|
||||||
|
|
||||||
public static void SetRegId(this User user, string regId)
|
public static string GetSpecialFolder(this string specialPath)
|
||||||
{
|
{
|
||||||
if (user.YavscTokens == null)
|
if (specialPath == null)
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
|
var appData =
|
||||||
|
System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
|
||||||
|
string imagesFolder = System.IO.Path.Combine(appData, specialPath);
|
||||||
|
DirectoryInfo di = new DirectoryInfo(imagesFolder);
|
||||||
|
// FIXME Create this folder at app startup
|
||||||
|
if (!di.Exists) di.Create();
|
||||||
|
return imagesFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetTmpDir ()
|
||||||
|
{
|
||||||
|
return GetSpecialFolder("tmp");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,11 +505,7 @@ namespace ZicMoove.Droid
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (imagesFolder != null) return imagesFolder;
|
if (imagesFolder != null) return imagesFolder;
|
||||||
var appData =
|
imagesFolder = Constants.ImagePath.GetSpecialFolder();
|
||||||
System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
|
|
||||||
imagesFolder = System.IO.Path.Combine(appData, Constants.ImagePath);
|
|
||||||
DirectoryInfo di = new DirectoryInfo(imagesFolder);
|
|
||||||
if (!di.Exists) di.Create();
|
|
||||||
return imagesFolder;
|
return imagesFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user