Example #1
0
        public static string GenerateSourceFilePath(ContentRef <Resource> r, string srcFileExt)
        {
            string filePath = PathHelper.MakeFilePathRelative(r.Path, DualityApp.DataDirectory);
            string fileDir  = Path.GetDirectoryName(filePath);

            if (filePath.Contains(".."))
            {
                filePath = Path.GetFileName(filePath);
                fileDir  = ".";
            }
            return(PathHelper.GetFreePath(Path.Combine(Path.Combine(EditorHelper.SourceMediaDirectory, fileDir), r.Name), srcFileExt));
        }
Example #2
0
        private static void PrepareImportFilePaths(string filePath, out string srcFilePath, out string targetName, out string targetDir)
        {
            srcFilePath = PathHelper.MakeFilePathRelative(filePath, DualityApp.DataDirectory);
            if (srcFilePath.Contains(".."))
            {
                srcFilePath = Path.GetFileName(srcFilePath);
            }

            targetDir  = Path.GetDirectoryName(Path.Combine(DualityApp.DataDirectory, srcFilePath));
            targetName = Path.GetFileNameWithoutExtension(filePath);

            srcFilePath = PathHelper.GetFreePath(
                Path.Combine(EditorHelper.SourceMediaDirectory, Path.GetFileNameWithoutExtension(srcFilePath)),
                Path.GetExtension(srcFilePath));
        }