Skip to content

Commit

Permalink
Renamed FilePathAttribute to EditorFilePathAttribute
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsakharov committed Apr 5, 2024
1 parent fda5297 commit 54e0678
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Prowl.Editor/Assets/AssetDatabase.Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Prowl.Editor.Assets
{
[FilePath("Library/LastWriteTimes.cache", FilePathAttribute.Location.ProjectFolder)]
[EditorFilePath("Library/LastWriteTimes.cache", EditorFilePathAttribute.Location.ProjectFolder)]
public class LastWriteTimesCache : ScriptableSingleton<LastWriteTimesCache>
{
public readonly Dictionary<string, DateTime> fileLastWriteTimes = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Prowl.Editor.Editor.Preferences
{
[FilePath("AssetPipeline.pref", FilePathAttribute.Location.PreferencesFolder)]
[EditorFilePath("AssetPipeline.pref", EditorFilePathAttribute.Location.PreferencesFolder)]
public class AssetPipelinePreferences : ScriptableSingleton<AssetPipelinePreferences>
{
[Text("Asset Browser:")]
Expand Down
2 changes: 1 addition & 1 deletion Prowl.Editor/Editor/Preferences/GeneralPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Prowl.Editor.Editor.Preferences
{
[FilePath("General.pref", FilePathAttribute.Location.PreferencesFolder)]
[EditorFilePath("General.pref", EditorFilePathAttribute.Location.PreferencesFolder)]
public class GeneralPreferences : ScriptableSingleton<GeneralPreferences>
{
[Text("General:")]
Expand Down
2 changes: 1 addition & 1 deletion Prowl.Editor/Editor/Preferences/SceneViewPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Prowl.Editor.Editor.Preferences
{
[FilePath("SceneView.pref", FilePathAttribute.Location.PreferencesFolder)]
[EditorFilePath("SceneView.pref", EditorFilePathAttribute.Location.PreferencesFolder)]
public class SceneViewPreferences : ScriptableSingleton<SceneViewPreferences>
{
[Text("Controls:")]
Expand Down
2 changes: 1 addition & 1 deletion Prowl.Editor/Editor/ProjectSettings/BuildProjectSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Prowl.Editor.Editor.ProjectSettings
{
[FilePath("BuildSettings.projsetting", FilePathAttribute.Location.ProjectSettingsFolder)]
[EditorFilePath("BuildSettings.projsetting", EditorFilePathAttribute.Location.ProjectSettingsFolder)]
public class BuildProjectSetting : ScriptableSingleton<BuildProjectSetting>
{
public AssetRef<Scene> InitialScene;
Expand Down
12 changes: 6 additions & 6 deletions Prowl.Editor/Utilities/ScriptableSingleton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Prowl.Editor.Utilities
{
[AttributeUsage(AttributeTargets.Class)]
public class FilePathAttribute : Attribute
public class EditorFilePathAttribute : Attribute
{
public enum Location
{
Expand All @@ -15,7 +15,7 @@ public enum Location
public string FilePath { get; }
public Location FileLocation { get; }

public FilePathAttribute(string filePath, Location fileLocation)
public EditorFilePathAttribute(string filePath, Location fileLocation)
{
FilePath = filePath;
FileLocation = fileLocation;
Expand Down Expand Up @@ -43,19 +43,19 @@ public void Save()

protected string GetFilePath()
{
var attribute = Attribute.GetCustomAttribute(GetType(), typeof(FilePathAttribute)) as FilePathAttribute;
var attribute = Attribute.GetCustomAttribute(GetType(), typeof(EditorFilePathAttribute)) as EditorFilePathAttribute;
if (attribute != null)
{
string directory = string.Empty;
switch (attribute.FileLocation)
{
case FilePathAttribute.Location.ProjectFolder:
case EditorFilePathAttribute.Location.ProjectFolder:
directory = Project.ProjectDirectory;
break;
case FilePathAttribute.Location.ProjectSettingsFolder:
case EditorFilePathAttribute.Location.ProjectSettingsFolder:
directory = Path.Combine(Project.ProjectDirectory, "ProjectSettings");
break;
case FilePathAttribute.Location.PreferencesFolder:
case EditorFilePathAttribute.Location.PreferencesFolder:
// Persistent across all projects
directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Prowl", "Editor");
break;
Expand Down

0 comments on commit 54e0678

Please sign in to comment.