-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathSpecialFolder.cs
More file actions
33 lines (29 loc) · 1.16 KB
/
Copy pathSpecialFolder.cs
File metadata and controls
33 lines (29 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using ThunderKit.Core.Pipelines;
using UnityEngine;
namespace ThunderKit.Core.Paths.Components
{
public class SpecialFolder : PathComponent
{
[Tooltip("Resolved per platform. ApplicationData: %APPDATA%, ~/.config, ~/Library/Application Support")]
public Environment.SpecialFolder Folder = Environment.SpecialFolder.ApplicationData;
protected override string GetPathInternal(PathReference output, Pipeline pipeline)
{
string folderPath;
try
{
folderPath = Environment.GetFolderPath(Folder);
}
catch (ArgumentException argumentException)
{
throw new InvalidOperationException(
$"{PathDiagnostics.Link(output, this)} is set to {(int)Folder}, which is not a known special folder.",
argumentException);
}
if (string.IsNullOrEmpty(folderPath))
throw new InvalidOperationException(
$"{PathDiagnostics.Link(output, this)} requested {Folder}, which has no location on this platform.");
return folderPath;
}
}
}