mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Made workspace user file try to use workspace-relative paths
This commit is contained in:
parent
10da44e341
commit
980132c3cc
4 changed files with 77 additions and 26 deletions
|
@ -54,6 +54,11 @@ namespace System.IO
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsDirectorySeparatorChar(char8 c)
|
||||||
|
{
|
||||||
|
return (c == DirectorySeparatorChar) || (c == AltDirectorySeparatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
public static void ChangeExtension(StringView path, StringView ext, String outPath)
|
public static void ChangeExtension(StringView path, StringView ext, String outPath)
|
||||||
{
|
{
|
||||||
if (path.IsNull)
|
if (path.IsNull)
|
||||||
|
|
|
@ -1708,7 +1708,11 @@ namespace IDE
|
||||||
using (sd.CreateArray("RecentFilesList"))
|
using (sd.CreateArray("RecentFilesList"))
|
||||||
{
|
{
|
||||||
for (var recentFile in mRecentlyDisplayedFiles)
|
for (var recentFile in mRecentlyDisplayedFiles)
|
||||||
sd.Add(recentFile);
|
{
|
||||||
|
String relPath = scope .();
|
||||||
|
mWorkspace.GetWorkspaceRelativePath(recentFile, relPath);
|
||||||
|
sd.Add(relPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using (sd.CreateArray("Breakpoints"))
|
using (sd.CreateArray("Breakpoints"))
|
||||||
|
@ -1721,7 +1725,9 @@ namespace IDE
|
||||||
{
|
{
|
||||||
if (breakpoint.mFileName != null)
|
if (breakpoint.mFileName != null)
|
||||||
{
|
{
|
||||||
sd.Add("File", breakpoint.mFileName);
|
String relPath = scope .();
|
||||||
|
mWorkspace.GetWorkspaceRelativePath(breakpoint.mFileName, relPath);
|
||||||
|
sd.Add("File", relPath);
|
||||||
sd.Add("Line", breakpoint.mLineNum);
|
sd.Add("Line", breakpoint.mLineNum);
|
||||||
sd.Add("Column", breakpoint.mColumn);
|
sd.Add("Column", breakpoint.mColumn);
|
||||||
if (breakpoint.mInstrOffset != -1)
|
if (breakpoint.mInstrOffset != -1)
|
||||||
|
@ -1755,7 +1761,9 @@ namespace IDE
|
||||||
{
|
{
|
||||||
using (sd.CreateObject())
|
using (sd.CreateObject())
|
||||||
{
|
{
|
||||||
sd.Add("File", bookmark.mFileName);
|
String relPath = scope .();
|
||||||
|
mWorkspace.GetWorkspaceRelativePath(bookmark.mFileName, relPath);
|
||||||
|
sd.Add("File", relPath);
|
||||||
sd.Add("Line", bookmark.mLineNum);
|
sd.Add("Line", bookmark.mLineNum);
|
||||||
sd.Add("Column", bookmark.mColumn);
|
sd.Add("Column", bookmark.mColumn);
|
||||||
}
|
}
|
||||||
|
@ -2907,17 +2915,21 @@ namespace IDE
|
||||||
DeleteAndClearItems!(mRecentlyDisplayedFiles);
|
DeleteAndClearItems!(mRecentlyDisplayedFiles);
|
||||||
for (data.Enumerate("RecentFilesList"))
|
for (data.Enumerate("RecentFilesList"))
|
||||||
{
|
{
|
||||||
String fileStr = new String();
|
String relPath = scope String();
|
||||||
data.GetCurString(fileStr);
|
data.GetCurString(relPath);
|
||||||
IDEUtils.FixFilePath(fileStr);
|
IDEUtils.FixFilePath(relPath);
|
||||||
mRecentlyDisplayedFiles.Add(fileStr);
|
String absPath = new String();
|
||||||
|
mWorkspace.GetWorkspaceAbsPath(relPath, absPath);
|
||||||
|
mRecentlyDisplayedFiles.Add(absPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var _breakpoint in data.Enumerate("Breakpoints"))
|
for (var _breakpoint in data.Enumerate("Breakpoints"))
|
||||||
{
|
{
|
||||||
String fileName = scope String();
|
String relPath = scope String();
|
||||||
data.GetString("File", fileName);
|
data.GetString("File", relPath);
|
||||||
IDEUtils.FixFilePath(fileName);
|
IDEUtils.FixFilePath(relPath);
|
||||||
|
String absPath = scope String();
|
||||||
|
mWorkspace.GetWorkspaceAbsPath(relPath, absPath);
|
||||||
int32 lineNum = data.GetInt("Line");
|
int32 lineNum = data.GetInt("Line");
|
||||||
int32 column = data.GetInt("Column");
|
int32 column = data.GetInt("Column");
|
||||||
int32 instrOffset = data.GetInt("InstrOffset", -1);
|
int32 instrOffset = data.GetInt("InstrOffset", -1);
|
||||||
|
@ -2926,8 +2938,8 @@ namespace IDE
|
||||||
Breakpoint breakpoint = null;
|
Breakpoint breakpoint = null;
|
||||||
if (memoryWatchExpression.Length > 0)
|
if (memoryWatchExpression.Length > 0)
|
||||||
breakpoint = mDebugger.CreateMemoryBreakpoint(memoryWatchExpression, (int)0, 0, null);
|
breakpoint = mDebugger.CreateMemoryBreakpoint(memoryWatchExpression, (int)0, 0, null);
|
||||||
else if (fileName.Length > 0)
|
else if (absPath.Length > 0)
|
||||||
breakpoint = mDebugger.CreateBreakpoint(fileName, lineNum, column, instrOffset);
|
breakpoint = mDebugger.CreateBreakpoint(absPath, lineNum, column, instrOffset);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String symbol = scope .();
|
String symbol = scope .();
|
||||||
|
@ -2961,12 +2973,14 @@ namespace IDE
|
||||||
|
|
||||||
for (var _bookmark in data.Enumerate("Bookmarks"))
|
for (var _bookmark in data.Enumerate("Bookmarks"))
|
||||||
{
|
{
|
||||||
String fileName = scope String();
|
String relPath = scope String();
|
||||||
data.GetString("File", fileName);
|
data.GetString("File", relPath);
|
||||||
IDEUtils.FixFilePath(fileName);
|
IDEUtils.FixFilePath(relPath);
|
||||||
|
String absPath = scope String();
|
||||||
|
mWorkspace.GetWorkspaceAbsPath(relPath, absPath);
|
||||||
int32 lineNum = data.GetInt("Line");
|
int32 lineNum = data.GetInt("Line");
|
||||||
int32 column = data.GetInt("Column");
|
int32 column = data.GetInt("Column");
|
||||||
mBookmarkManager.CreateBookmark(fileName, lineNum, column);
|
mBookmarkManager.CreateBookmark(absPath, lineNum, column);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var referenceId in data.Enumerate("DebuggerDisplayTypes"))
|
for (var referenceId in data.Enumerate("DebuggerDisplayTypes"))
|
||||||
|
|
|
@ -8,6 +8,7 @@ using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using IDE.Util;
|
using IDE.Util;
|
||||||
using IDE.util;
|
using IDE.util;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace IDE
|
namespace IDE
|
||||||
{
|
{
|
||||||
|
@ -494,6 +495,25 @@ namespace IDE
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GetWorkspaceRelativePath(StringView inAbsPath, String outRelPath)
|
||||||
|
{
|
||||||
|
if ((inAbsPath.Length > mDir.Length) &&
|
||||||
|
(Path.Equals(.(inAbsPath, 0, mDir.Length), mDir)) &&
|
||||||
|
(Path.IsDirectorySeparatorChar(inAbsPath[mDir.Length])))
|
||||||
|
{
|
||||||
|
outRelPath.Append(StringView(inAbsPath, mDir.Length + 1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outRelPath.Append(inAbsPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetWorkspaceAbsPath(StringView inRelPath, String outAbsPath)
|
||||||
|
{
|
||||||
|
if (inRelPath.IsEmpty)
|
||||||
|
return;
|
||||||
|
Path.GetAbsolutePath(inRelPath, mDir, outAbsPath);
|
||||||
|
}
|
||||||
|
|
||||||
public void Serialize(StructuredData data)
|
public void Serialize(StructuredData data)
|
||||||
{
|
{
|
||||||
void WriteStrings(String name, List<String> strs)
|
void WriteStrings(String name, List<String> strs)
|
||||||
|
|
|
@ -678,9 +678,15 @@ namespace IDE.ui
|
||||||
return;
|
return;
|
||||||
|
|
||||||
data.Add("Type", "SourceViewPanel");
|
data.Add("Type", "SourceViewPanel");
|
||||||
data.Add("FilePath", mFilePath);
|
String relPath = scope String();
|
||||||
|
gApp.mWorkspace.GetWorkspaceRelativePath(mFilePath, relPath);
|
||||||
|
data.Add("FilePath", relPath);
|
||||||
if (mAliasFilePath != null)
|
if (mAliasFilePath != null)
|
||||||
data.Add("AliasFilePath", mAliasFilePath);
|
{
|
||||||
|
String relAliasPath = scope .();
|
||||||
|
gApp.mWorkspace.GetWorkspaceRelativePath(mAliasFilePath, relAliasPath);
|
||||||
|
data.Add("AliasFilePath", relAliasPath);
|
||||||
|
}
|
||||||
data.ConditionalAdd("CursorPos", mEditWidget.Content.CursorTextPos, 0);
|
data.ConditionalAdd("CursorPos", mEditWidget.Content.CursorTextPos, 0);
|
||||||
data.ConditionalAdd("VertPos", mEditWidget.mVertScrollbar.mContentPos, 0);
|
data.ConditionalAdd("VertPos", mEditWidget.mVertScrollbar.mContentPos, 0);
|
||||||
if (mProjectSource != null)
|
if (mProjectSource != null)
|
||||||
|
@ -691,15 +697,21 @@ namespace IDE.ui
|
||||||
{
|
{
|
||||||
base.Deserialize(data);
|
base.Deserialize(data);
|
||||||
|
|
||||||
String filePath = scope String();
|
String relFilePath = scope String();
|
||||||
data.GetString("FilePath", filePath);
|
data.GetString("FilePath", relFilePath);
|
||||||
|
String absFilePath = scope String();
|
||||||
|
gApp.mWorkspace.GetWorkspaceAbsPath(relFilePath, absFilePath);
|
||||||
|
|
||||||
String projectName = scope String();
|
String projectName = scope String();
|
||||||
data.GetString("ProjectName", projectName);
|
data.GetString("ProjectName", projectName);
|
||||||
|
|
||||||
var aliasFilePath = scope String();
|
var relAliasFilePath = scope String();
|
||||||
data.GetString("AliasFilePath", aliasFilePath);
|
data.GetString("AliasFilePath", relAliasFilePath);
|
||||||
if (!aliasFilePath.IsEmpty)
|
if (!relAliasFilePath.IsEmpty)
|
||||||
mAliasFilePath = new String(aliasFilePath);
|
{
|
||||||
|
mAliasFilePath = new String();
|
||||||
|
gApp.mWorkspace.GetWorkspaceAbsPath(relAliasFilePath, mAliasFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
bool foundProjectSource = false;
|
bool foundProjectSource = false;
|
||||||
if (projectName != null)
|
if (projectName != null)
|
||||||
|
@ -708,7 +720,7 @@ namespace IDE.ui
|
||||||
if (project != null)
|
if (project != null)
|
||||||
{
|
{
|
||||||
String relPath = scope String();
|
String relPath = scope String();
|
||||||
project.GetProjectRelPath(filePath, relPath);
|
project.GetProjectRelPath(absFilePath, relPath);
|
||||||
var projectItem = IDEApp.sApp.FindProjectItem(project.mRootFolder, relPath);
|
var projectItem = IDEApp.sApp.FindProjectItem(project.mRootFolder, relPath);
|
||||||
if (projectItem != null)
|
if (projectItem != null)
|
||||||
{
|
{
|
||||||
|
@ -721,7 +733,7 @@ namespace IDE.ui
|
||||||
|
|
||||||
if (!foundProjectSource)
|
if (!foundProjectSource)
|
||||||
{
|
{
|
||||||
if (!Show(filePath, true))
|
if (!Show(absFilePath, true))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int32 cursorPos = data.GetInt("CursorPos");
|
int32 cursorPos = data.GetInt("CursorPos");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue