示例#1
0
 public static void AssureDirectoryExist(string path)
 {
     if (!File.Exists(path))
     {
         var directoryPath = MFileEx.GetDirectoryName(path);
         if (!Directory.Exists(directoryPath))
         {
             Directory.CreateDirectory(directoryPath);
         }
     }
 }
示例#2
0
 public static void AssureFileExist(string path)
 {
     if (!File.Exists(path))
     {
         var directoryPath = MFileEx.GetDirectoryName(path);
         if (!Directory.Exists(directoryPath))
         {
             Directory.CreateDirectory(directoryPath);
         }
         FileStream fileStream = File.Create(path);
         fileStream.Close();
     }
 }
示例#3
0
        private static bool getEnvParamByLocalConf(string name, out string param)
        {
            var jsonFile = MFileEx.FindFileInParents(Directory.GetCurrentDirectory(), ENV_CONF_NAME);

            param = string.Empty;
            if (jsonFile == null)
            {
                return(false);
            }
            var txt = jsonFile.ReadText();
            var jo  = JsonMapper.ToObject(txt);
            var p   = jo[name];

            if (p != null)
            {
                param = (string)p;
                return(true);
            }
            return(false);
        }
示例#4
0
 /// <summary>
 /// 将相对于Asset的路径转换为绝对路径且去除后缀
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 public static string ConvertAssetPathToAbstractPathWithoutExtention(string path)
 {
     return(MFileEx.GetFilePathWithoutExtention(ConvertAssetPathToAbstractPath(path)));
 }