Ejemplo n.º 1
0
        private void InitContentDir(ref string DirPath)
        {
            try
            {
                DirPath = Directory.GetCurrentDirectory();
                if (DirPath.Contains("src"))
                {
                    int startIdx = Directory.GetCurrentDirectory().IndexOf("src");
                    DirPath = Directory.GetCurrentDirectory().Substring(0, startIdx - 1);
                    DirPath = $"{Directory.GetParent(DirPath)}/ZMOD";
                }
                else
                {
                    DirPath = Directory.GetParent(DirPath).ToString() + "/ZMOD";
                }

                System.Console.WriteLine(Directory.GetCurrentDirectory());
                if (!Directory.Exists(DirPath))
                {
                    Directory.CreateDirectory(DirPath);
                }
                if (string.IsNullOrEmpty(DirectoryHelper.fileUploadDirectoryPath))
                {
                    DirectoryHelper.fileUploadDirectoryPath = DirPath.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
                }
                DirectoryCreator.CreateFolders(DirPath);
                Logger.Log(LogLevel.Information, "Initialize content directory : " + DirPath);
            }
            catch (Exception ex)
            {
                Logger.LogCritical("Initializing ZMOD directory " + ex.StackTrace);
            }
        }