mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Removed extension methods as they are part of corelib now
This commit is contained in:
@@ -2,16 +2,6 @@ namespace System
|
|||||||
{
|
{
|
||||||
public extension Array1<T>
|
public extension Array1<T>
|
||||||
{
|
{
|
||||||
/// Returns the index of the given element or -1 if it is not in this array.
|
|
||||||
public int IndexOf(T element)
|
|
||||||
{
|
|
||||||
for(int i < mLength)
|
|
||||||
if(Ptr[i] == element)
|
|
||||||
return i;
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses Binary Search to find the index of the given Element.
|
* Uses Binary Search to find the index of the given Element.
|
||||||
* @param element The element whose element will be returned.
|
* @param element The element whose element will be returned.
|
||||||
|
|||||||
@@ -10,53 +10,4 @@ extension Directory
|
|||||||
// TODO: This is obviously windows only
|
// TODO: This is obviously windows only
|
||||||
return PathIsDirectoryEmptyW(fileName.ToScopedNativeWChar!());
|
return PathIsDirectoryEmptyW(fileName.ToScopedNativeWChar!());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result<void, Platform.BfpFileResult> Copy(StringView fromPath, StringView toPath)
|
|
||||||
{
|
|
||||||
if (fromPath.Length <= 2)
|
|
||||||
return .Err(.InvalidParameter);
|
|
||||||
if ((fromPath[0] != '/') && (fromPath[0] != '\\'))
|
|
||||||
{
|
|
||||||
if (fromPath[1] == ':')
|
|
||||||
{
|
|
||||||
if (fromPath.Length < 3)
|
|
||||||
return .Err(.InvalidParameter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Directory.Exists(fromPath))
|
|
||||||
return .Err(.NotFound);
|
|
||||||
|
|
||||||
Try!(Directory.CreateDirectory(toPath));
|
|
||||||
|
|
||||||
for (var directoryEntry in Directory.EnumerateDirectories(fromPath))
|
|
||||||
{
|
|
||||||
let dirFromPath = scope String();
|
|
||||||
directoryEntry.GetFilePath(dirFromPath);
|
|
||||||
|
|
||||||
let dirName = scope String();
|
|
||||||
directoryEntry.GetFileName(dirName);
|
|
||||||
|
|
||||||
let dirToPath = scope String();
|
|
||||||
Path.Combine(dirToPath, toPath, dirName);
|
|
||||||
|
|
||||||
Try!(Copy(dirFromPath, dirToPath));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var fileEntry in Directory.EnumerateFiles(fromPath))
|
|
||||||
{
|
|
||||||
let fileFromPath = scope String();
|
|
||||||
fileEntry.GetFilePath(fileFromPath);
|
|
||||||
|
|
||||||
let fileName = scope String();
|
|
||||||
fileEntry.GetFileName(fileName);
|
|
||||||
|
|
||||||
let fileToPath = scope String();
|
|
||||||
Path.Combine(fileToPath, toPath, fileName);
|
|
||||||
|
|
||||||
Try!(File.Copy(fileFromPath, fileToPath));
|
|
||||||
}
|
|
||||||
|
|
||||||
return .Ok;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user