Skip to content

Commit

Permalink
removed directory creation
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSimons committed Oct 21, 2024
1 parent 6e68371 commit 52a54f5
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions Assets/Scripts/Layers/Adapters/DataTypeAdapters/FileTypeAdapter.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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<FileTypeEvent> fileTypeEvents;

public void ProcessFiles(string files)
Expand All @@ -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('.'))
Expand Down

0 comments on commit 52a54f5

Please sign in to comment.