add File.Delete · Drake53/CSharp.lua@0e88988 · GitHub
Skip to content

Commit 0e88988

Browse files
committed
add File.Delete
1 parent dcfc6a5 commit 0e88988

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

‎CSharp.lua/CoreSystem.Lua/CoreSystem/DateTime.lua‎

Lines changed: 3 additions & 1 deletion

‎CSharp.lua/CoreSystem.Lua/CoreSystem/IO/File.lua‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ local each = System.each
2020

2121
local io = io
2222
local open = io.open
23+
local remove = os.remove
2324

2425
local IOException = System.define("System.IO.IOException", {
2526
__tostring = System.Exception.ToString,
@@ -94,4 +95,11 @@ function File.Exists(path)
9495
return file ~= nil
9596
end
9697

98+
function File.Delete(path)
99+
local ok, err = remove(path)
100+
if not ok then
101+
throw(IOException(err))
102+
end
103+
end
104+
97105
System.define("System.IO.File", File)

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Type.lua‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ limitations under the License.
1717
local System = System
1818
local throw = System.throw
1919
local Object = System.Object
20-
local Char = System.Char
21-
local Int = System.Int
22-
local Double = System.Double
2320
local String = System.String
2421
local Boolean = System.Boolean
2522
local Delegate = System.Delegate

‎CSharp.lua/CoreSystem.Lua/Sample/test.lua‎

Lines changed: 5 additions & 5 deletions

0 commit comments

Comments
 (0)