mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-11-04 12:51:48 +00:00
More robust "recent projects" deduplication
This commit is contained in:
@@ -75,14 +75,6 @@ namespace GlitchyEditor
|
|||||||
|
|
||||||
private float _fixedTimestep = 1.0f / 60.0f;
|
private float _fixedTimestep = 1.0f / 60.0f;
|
||||||
|
|
||||||
append List<(String Name, String Path)> _recentScenePaths = .() ~ {
|
|
||||||
for (var item in _)
|
|
||||||
{
|
|
||||||
delete item.Name;
|
|
||||||
delete item.Path;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private GameTime _simulationGameTime = new .() ~ delete _;
|
private GameTime _simulationGameTime = new .() ~ delete _;
|
||||||
|
|
||||||
/// Gets or sets the path of the current scene.
|
/// Gets or sets the path of the current scene.
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ class Project
|
|||||||
{
|
{
|
||||||
_workspacePath = new String(workspacePath.Length);
|
_workspacePath = new String(workspacePath.Length);
|
||||||
Path.GetFullPath(workspacePath, _workspacePath);
|
Path.GetFullPath(workspacePath, _workspacePath);
|
||||||
|
if (_workspacePath.EndsWith(Path.DirectorySeparatorChar))
|
||||||
|
_workspacePath.RemoveFromEnd(1);
|
||||||
|
|
||||||
_assetsFolder = new String();
|
_assetsFolder = new String();
|
||||||
PathInProject(_assetsFolder, "Assets");
|
PathInProject(_assetsFolder, "Assets");
|
||||||
|
|||||||
@@ -375,17 +375,25 @@ class EditorSettings
|
|||||||
if (_recentProjects == null)
|
if (_recentProjects == null)
|
||||||
_recentProjects = new List<String>();
|
_recentProjects = new List<String>();
|
||||||
|
|
||||||
|
String absolutePath = new String(value.Length);
|
||||||
|
Path.GetFullPath(value, absolutePath);
|
||||||
|
if (absolutePath.EndsWith(Path.DirectorySeparatorChar))
|
||||||
|
absolutePath.RemoveFromEnd(1);
|
||||||
|
|
||||||
// Remove duplicates
|
// Remove duplicates
|
||||||
for (var entry in _recentProjects)
|
for (var entry in _recentProjects)
|
||||||
{
|
{
|
||||||
if (entry == value)
|
if (entry.EndsWith(Path.DirectorySeparatorChar))
|
||||||
|
entry.RemoveFromEnd(1);
|
||||||
|
|
||||||
|
if (Path.Equals(entry, absolutePath))
|
||||||
{
|
{
|
||||||
delete entry;
|
delete entry;
|
||||||
@entry.Remove();
|
@entry.Remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_recentProjects.Insert(0, new String(value));
|
_recentProjects.Insert(0, absolutePath);
|
||||||
|
|
||||||
if (_recentProjects.Count > 10)
|
if (_recentProjects.Count > 10)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user