mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
Fixed FileWatcher overflow manual override
This commit is contained in:
parent
07cdbbf142
commit
716ec05394
4 changed files with 51 additions and 5 deletions
|
@ -10,6 +10,7 @@ using Beefy.utils;
|
||||||
using IDE.Util;
|
using IDE.Util;
|
||||||
using IDE.ui;
|
using IDE.ui;
|
||||||
using IDE.util;
|
using IDE.util;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace IDE.Compiler
|
namespace IDE.Compiler
|
||||||
{
|
{
|
||||||
|
@ -419,6 +420,7 @@ namespace IDE.Compiler
|
||||||
var editData = gApp.GetEditData(projectSource, false);
|
var editData = gApp.GetEditData(projectSource, false);
|
||||||
using (gApp.mMonitor.Enter())
|
using (gApp.mMonitor.Enter())
|
||||||
{
|
{
|
||||||
|
editData.mFileTime = File.GetLastWriteTime(sourceFilePath).GetValueOrDefault();
|
||||||
editData.SetSavedData(data, char8IdData);
|
editData.SetSavedData(data, char8IdData);
|
||||||
if (hash case .MD5(let md5Hash))
|
if (hash case .MD5(let md5Hash))
|
||||||
editData.mMD5Hash = md5Hash;
|
editData.mMD5Hash = md5Hash;
|
||||||
|
|
|
@ -44,6 +44,7 @@ namespace IDE
|
||||||
public MD5Hash mRecoveryHash;
|
public MD5Hash mRecoveryHash;
|
||||||
public MD5Hash mMD5Hash;
|
public MD5Hash mMD5Hash;
|
||||||
public SHA256Hash mSHA256Hash;
|
public SHA256Hash mSHA256Hash;
|
||||||
|
public DateTime mFileTime;
|
||||||
|
|
||||||
public this()
|
public this()
|
||||||
{
|
{
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace IDE
|
||||||
var newPath;
|
var newPath;
|
||||||
if (isDirectory)
|
if (isDirectory)
|
||||||
{
|
{
|
||||||
if (newPath.EndsWith(Path.DirectorySeparatorChar))
|
if ((newPath != null) && (newPath.EndsWith(Path.DirectorySeparatorChar)))
|
||||||
{
|
{
|
||||||
newPath = scope:: String();
|
newPath = scope:: String();
|
||||||
newPath.Append(@newPath, 0, @newPath.Length - 1);
|
newPath.Append(@newPath, 0, @newPath.Length - 1);
|
||||||
|
@ -259,9 +259,9 @@ namespace IDE
|
||||||
{
|
{
|
||||||
String fullPath = scope String();
|
String fullPath = scope String();
|
||||||
fullPath.Append(fileSystemWatcher.Directory);
|
fullPath.Append(fileSystemWatcher.Directory);
|
||||||
|
fullPath.Append(Path.DirectorySeparatorChar);
|
||||||
if (fileName != null)
|
if (fileName != null)
|
||||||
{
|
{
|
||||||
fullPath.Append(Path.DirectorySeparatorChar);
|
|
||||||
fullPath.Append(fileName);
|
fullPath.Append(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1462,6 +1462,8 @@ namespace IDE
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editData.mFileTime = File.GetLastWriteTime(path).GetValueOrDefault();
|
||||||
|
|
||||||
editData.mLastFileTextVersion = editData.mEditWidget.Content.mData.mCurTextVersionId;
|
editData.mLastFileTextVersion = editData.mEditWidget.Content.mData.mCurTextVersionId;
|
||||||
mFileWatcher.OmitFileChange(path, text);
|
mFileWatcher.OmitFileChange(path, text);
|
||||||
if (forcePath == null)
|
if (forcePath == null)
|
||||||
|
@ -5935,6 +5937,7 @@ namespace IDE
|
||||||
editData.BuildHash(text);
|
editData.BuildHash(text);
|
||||||
} ) case .Err)
|
} ) case .Err)
|
||||||
return false;
|
return false;
|
||||||
|
editData.mFileTime = File.GetLastWriteTime(editData.mFilePath).GetValueOrDefault();
|
||||||
|
|
||||||
mFileWatcher.FileIsValid(editData.mFilePath);
|
mFileWatcher.FileIsValid(editData.mFilePath);
|
||||||
|
|
||||||
|
@ -8383,6 +8386,7 @@ namespace IDE
|
||||||
if (*sourceHash case .MD5(let md5Hash))
|
if (*sourceHash case .MD5(let md5Hash))
|
||||||
editData.mMD5Hash = md5Hash;
|
editData.mMD5Hash = md5Hash;
|
||||||
}
|
}
|
||||||
|
editData.mFileTime = File.GetLastWriteTime(fullPath).GetValueOrDefault();
|
||||||
}
|
}
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
@ -12688,6 +12692,46 @@ namespace IDE
|
||||||
if (let projectFolder = projectItem as ProjectFolder)
|
if (let projectFolder = projectItem as ProjectFolder)
|
||||||
mProjectPanel.QueueRehupFolder(projectFolder);
|
mProjectPanel.QueueRehupFolder(projectFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Manually scan project files for changes
|
||||||
|
mWorkspace.WithProjectItems(scope (projectItem) =>
|
||||||
|
{
|
||||||
|
var projectSource = projectItem as ProjectSource;
|
||||||
|
if (projectSource != null)
|
||||||
|
{
|
||||||
|
bool changed = false;
|
||||||
|
var editData = projectSource.mEditData;
|
||||||
|
if (editData != null)
|
||||||
|
{
|
||||||
|
if (File.GetLastWriteTime(editData.mFilePath) case .Ok(let fileTime))
|
||||||
|
{
|
||||||
|
if (fileTime != projectSource.mEditData.mFileTime)
|
||||||
|
{
|
||||||
|
if (!projectSource.mEditData.mMD5Hash.IsZero)
|
||||||
|
{
|
||||||
|
var text = scope String();
|
||||||
|
if (File.ReadAllText(editData.mFilePath, text, true) case .Ok)
|
||||||
|
{
|
||||||
|
var hash = MD5.Hash(.((.)text.Ptr, text.Length));
|
||||||
|
if (hash != projectSource.mEditData.mMD5Hash)
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
mFileWatcher.FileChanged(editData.mFilePath);
|
||||||
|
projectSource.mEditData.mFileTime = fileTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12797,6 +12841,7 @@ namespace IDE
|
||||||
}
|
}
|
||||||
editData.mFileDeleted = true;
|
editData.mFileDeleted = true;
|
||||||
}
|
}
|
||||||
|
editData.mFileTime = File.GetLastWriteTime(fileName);
|
||||||
|
|
||||||
using (mMonitor.Enter())
|
using (mMonitor.Enter())
|
||||||
{
|
{
|
||||||
|
@ -13101,7 +13146,7 @@ namespace IDE
|
||||||
if ((projectSource.mEditData != null) && (projectSource.mEditData.HasTextChanged()))
|
if ((projectSource.mEditData != null) && (projectSource.mEditData.HasTextChanged()))
|
||||||
{
|
{
|
||||||
var sourceViewPanel = projectSource.mEditData?.mEditWidget.mPanel as SourceViewPanel;
|
var sourceViewPanel = projectSource.mEditData?.mEditWidget.mPanel as SourceViewPanel;
|
||||||
Debug.Assert(sourceViewPanel != null);
|
Runtime.Assert(sourceViewPanel != null, "Source marked as modified with no SourceViewPanel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13117,10 +13162,8 @@ namespace IDE
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
if (mUpdateCnt % 120 == 0)
|
if (mUpdateCnt % 120 == 0)
|
||||||
VerifyModifiedBuffers();
|
VerifyModifiedBuffers();
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mWantShowOutput)
|
if (mWantShowOutput)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue