1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 12:02:21 +02:00

Added UnversionedLibDir to config

This commit is contained in:
Brian Fiete 2019-10-04 10:39:25 -07:00
parent d48d03c58b
commit f258b4a25b
8 changed files with 81 additions and 39 deletions

View file

@ -410,6 +410,7 @@ namespace Beefy.utils
result = Enum.Parse<T>((StringView)obj); result = Enum.Parse<T>((StringView)obj);
else else
return; return;
if (result case .Ok(var parsedVal)) if (result case .Ok(var parsedVal))
val = parsedVal; val = parsedVal;
} }

View file

@ -1,19 +1,6 @@
Version = 1
UnversionedLibDirs = ["../../BeefLibs"]
[Registry.minlib] [Registry.minlib]
Version = "1.0.0" Version = "1.0.0"
Location = { Path = "../mintest/minlib" } Location = { Path = "../mintest/minlib" }
[Registry.corlib]
Version = "1.0.0"
Location = { Path = "../../BeefLibs/corlib" }
[Registry.Beefy2D]
Version = "1.0.0"
Location = { Path = "../../BeefLibs/Beefy2D" }
[Registry.SDL2]
Version = "1.0.0"
Location = { Path = "../../BeefLibs/SDL2" }
[Registry.MiniZ]
Version = "1.0.0"
Location = { Path = "../../BeefLibs/MiniZ" }

View file

@ -1,8 +1,6 @@
Version = 1
UnversionedLibDirs = ["../../../BeefLibs"]
[Registry.minlib] [Registry.minlib]
Version = "1.0.0" Version = "1.0.0"
Location = { Path = "../../mintest/minlib" } Location = { Path = "../../mintest/minlib" }
[Registry.corlib]
Version = "1.0.0"
Location = { Path = "../../../BeefLibs/corlib" }

View file

@ -1,15 +1,2 @@
[Registry.corlib] Version = 1
Version = "1.0.0" UnversionedLibDirs = ["../BeefLibs"]
Location = { Path = "../BeefLibs/corlib" }
[Registry.SDL2]
Version = "1.0.0"
Location = { Path = "../BeefLibs/SDL2" }
[Registry.MiniZ]
Version = "1.0.0"
Location = { Path = "../BeefLibs/MiniZ" }
[Registry.Beefy2D]
Version = "1.0.0"
Location = { Path = "../BeefLibs/Beefy2D" }

View file

@ -63,7 +63,7 @@ namespace IDE
regEntry.mLocation.Parse(data).IgnoreError(); regEntry.mLocation.Parse(data).IgnoreError();
} }
for (data.Enumerate("LibDirs")) for (data.Enumerate("UnversionedLibDirs"))
{ {
String dirStr = scope .(); String dirStr = scope .();
data.GetCurString(dirStr); data.GetCurString(dirStr);
@ -74,6 +74,39 @@ namespace IDE
libDir.mPath = new String(dirStr); libDir.mPath = new String(dirStr);
libDir.mConfigFile = configFile; libDir.mConfigFile = configFile;
mLibDirectories.Add(libDir); mLibDirectories.Add(libDir);
String absPath = scope .();
Path.GetAbsolutePath(libDir.mPath, configFile.mConfigDir, absPath);
for (var entry in Directory.EnumerateDirectories(absPath))
{
String projName = scope .();
entry.GetFileName(projName);
String filePath = scope .();
entry.GetFilePath(filePath);
String projFilePath = scope .();
projFilePath.Concat(filePath, "/BeefProj.toml");
if (File.Exists(projFilePath))
{
RegistryEntry regEntry = new RegistryEntry();
regEntry.mProjName = new String(projName);
mRegistry.Add(regEntry);
regEntry.mConfigFile = configFile;
var verString = scope String();
data.GetString("Version", verString);
regEntry.mVersion = new SemVer();
regEntry.mVersion.Parse("0.0.0");
regEntry.mLocation = new VerSpecRecord();
using (data.Open("Location"))
regEntry.mLocation.SetPath(filePath);
}
}
} }
} }
@ -82,6 +115,11 @@ namespace IDE
return .Ok; return .Ok;
} }
public void Refresh()
{
Load().IgnoreError();
}
public void QueuePaths(StringView topLevelDir) public void QueuePaths(StringView topLevelDir)
{ {
let dir = scope String(topLevelDir); let dir = scope String(topLevelDir);
@ -96,7 +134,7 @@ namespace IDE
if (File.Exists(path)) if (File.Exists(path))
{ {
if (mConfigPathQueue.Contains(path)) if (mConfigPathQueue.Contains(path))
break; // We have this and everthing under it already break; // We have this and everything under it already
mConfigPathQueue.Add(new String(path)); mConfigPathQueue.Add(new String(path));
} }
@ -116,6 +154,9 @@ namespace IDE
public Result<void> Load() public Result<void> Load()
{ {
ClearAndDeleteItems(mRegistry);
ClearAndDeleteItems(mConfigFiles);
for (int i = mConfigPathQueue.Count - 1; i >= 0; i--) for (int i = mConfigPathQueue.Count - 1; i >= 0; i--)
{ {
let path = mConfigPathQueue[i]; let path = mConfigPathQueue[i];

View file

@ -2225,6 +2225,8 @@ namespace IDE
if (StructuredLoad(data, workspaceFileName) case .Err(let err)) if (StructuredLoad(data, workspaceFileName) case .Err(let err))
{ {
mBeefConfig.Refresh();
switch (err) switch (err)
{ {
case .FormatError(int lineNum): case .FormatError(int lineNum):

View file

@ -1762,6 +1762,30 @@ namespace IDE
} }
} }
[IDECommand]
public void AssertIsAtColumn(String fileName, int column)
{
String filePath = scope String();
FixSrcPath(fileName, filePath);
var sourceViewPanel = GetActiveSourceViewPanel();
if (sourceViewPanel == null)
return;
if (!Path.Equals(filePath, sourceViewPanel.mFilePath))
{
ScriptManager.sActiveManager.Fail("Expected source file '{0}', got '{1}'", filePath, sourceViewPanel.mFilePath);
return;
}
let atColumn = sourceViewPanel.mEditWidget.mEditWidgetContent.CursorLineAndColumn.mColumn + 1;
if (atColumn != column)
{
ScriptManager.sActiveManager.Fail("Expected column '{0}', got '{1}'", column, atColumn);
return;
}
}
[IDECommand] [IDECommand]
public void GotoTextSkip(String findText, int skipIdx) public void GotoTextSkip(String findText, int skipIdx)
{ {

View file

@ -1291,7 +1291,7 @@ namespace IDE.ui
projectsReferenced.Add(selectedProjectItem.mProject); projectsReferenced.Add(selectedProjectItem.mProject);
folderCount++; folderCount++;
} }
else if (selectedProjectItem is ProjectItem) else
{ {
projectsReferenced.Add(selectedProjectItem.mProject); projectsReferenced.Add(selectedProjectItem.mProject);
fileCount++; fileCount++;
@ -1749,6 +1749,8 @@ namespace IDE.ui
void ImportProject() void ImportProject()
{ {
#if !CLI #if !CLI
gApp.mBeefConfig.Refresh();
var fileDialog = scope OpenFileDialog(); var fileDialog = scope OpenFileDialog();
fileDialog.ShowReadOnly = false; fileDialog.ShowReadOnly = false;
fileDialog.Title = "Import Project"; fileDialog.Title = "Import Project";