mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Supporting wildcard for CopyIfNewer
This commit is contained in:
parent
eb9943ca0a
commit
243ffaf851
1 changed files with 34 additions and 9 deletions
|
@ -1188,9 +1188,6 @@ namespace IDE
|
||||||
{
|
{
|
||||||
if (checkProject.HasDependency(depProject.mProjectName))
|
if (checkProject.HasDependency(depProject.mProjectName))
|
||||||
{
|
{
|
||||||
String fileName = scope .();
|
|
||||||
Path.GetFileName(srcPath, fileName);
|
|
||||||
|
|
||||||
List<String> targetPaths = scope .();
|
List<String> targetPaths = scope .();
|
||||||
defer ClearAndDeleteItems(targetPaths);
|
defer ClearAndDeleteItems(targetPaths);
|
||||||
|
|
||||||
|
@ -1203,13 +1200,41 @@ namespace IDE
|
||||||
String targetDirPath = scope .();
|
String targetDirPath = scope .();
|
||||||
Path.GetDirectoryPath(targetPaths[0], targetDirPath);
|
Path.GetDirectoryPath(targetPaths[0], targetDirPath);
|
||||||
|
|
||||||
String destPath = scope .();
|
bool CopyFile(String srcPath)
|
||||||
Path.GetAbsolutePath(fileName, targetDirPath, destPath);
|
|
||||||
|
|
||||||
if (File.CopyIfNewer(srcPath, destPath) case .Err)
|
|
||||||
{
|
{
|
||||||
mScriptManager.Fail("Failed to copy file '{}' to '{}'", srcPath, destPath);
|
String fileName = scope .();
|
||||||
return;
|
Path.GetFileName(srcPath, fileName);
|
||||||
|
|
||||||
|
String destPath = scope .();
|
||||||
|
Path.GetAbsolutePath(fileName, targetDirPath, destPath);
|
||||||
|
|
||||||
|
if (File.CopyIfNewer(srcPath, destPath) case .Err)
|
||||||
|
{
|
||||||
|
mScriptManager.Fail("Failed to copy file '{}' to '{}'", srcPath, destPath);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srcPath.Contains('*'))
|
||||||
|
{
|
||||||
|
String dirPath = scope .();
|
||||||
|
String wildcard = scope .();
|
||||||
|
Path.GetDirectoryPath(srcPath, dirPath);
|
||||||
|
Path.GetFileName(srcPath, wildcard);
|
||||||
|
|
||||||
|
for (let entry in Directory.EnumerateFiles(dirPath, wildcard))
|
||||||
|
{
|
||||||
|
String foundPath = scope .();
|
||||||
|
entry.GetFilePath(foundPath);
|
||||||
|
if (!CopyFile(foundPath))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!CopyFile(srcPath))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue