From 52a54f5b7a8ff957c3cd2e9cde645e808c9eb38b Mon Sep 17 00:00:00 2001 From: Tom Simons Date: Mon, 21 Oct 2024 16:13:31 +0200 Subject: [PATCH] removed directory creation --- .../DataTypeAdapters/FileTypeAdapter.cs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Assets/Scripts/Layers/Adapters/DataTypeAdapters/FileTypeAdapter.cs b/Assets/Scripts/Layers/Adapters/DataTypeAdapters/FileTypeAdapter.cs index 620089ba..1440a009 100644 --- a/Assets/Scripts/Layers/Adapters/DataTypeAdapters/FileTypeAdapter.cs +++ b/Assets/Scripts/Layers/Adapters/DataTypeAdapters/FileTypeAdapter.cs @@ -1,10 +1,7 @@ using System; -using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; -using Netherlands3D.Events; -using Netherlands3D.Twin.UI.LayerInspector; using UnityEngine; using UnityEngine.Events; @@ -20,7 +17,7 @@ public class FileTypeEvent [CreateAssetMenu(menuName = "Netherlands3D/Adapters/FileTypeAdapter", fileName = "FileTypeAdapter", order = 0)] public class FileTypeAdapter : ScriptableObject { - [SerializeField] private string assetsFolderName = "Assets"; + // [SerializeField] private string assetsFolderName = "Assets"; [SerializeField] private List fileTypeEvents; public void ProcessFiles(string files) @@ -38,21 +35,15 @@ public void ProcessFile(string file) file = file.Remove(file.Length - 1); var absoluteFilePath = Path.Combine(Application.persistentDataPath, file); - var assetsFolderPath = Path.Combine(Application.persistentDataPath, assetsFolderName); - - if (!Directory.Exists(assetsFolderPath)) - { - Directory.CreateDirectory(assetsFolderPath); - } var fileName = Path.GetFileNameWithoutExtension(file); var extension = Path.GetExtension(file).ToLower(); var guid = Guid.NewGuid(); - var newFilePathRelative = Path.Combine(assetsFolderName, guid + extension); - var newFilePathAbsolute = Path.Combine(assetsFolderPath, guid + extension); + var newFilePathRelative = guid + extension; + var newFilePathAbsolute = Path.Combine(Application.persistentDataPath, guid + extension); - Debug.Log(absoluteFilePath + " will be moved to: " + newFilePathAbsolute); + Debug.Log(absoluteFilePath + " will be copied to: " + newFilePathAbsolute); File.Copy(absoluteFilePath, newFilePathAbsolute); if (extension.StartsWith('.'))