Skip to content

Instantly share code, notes, and snippets.

@asterite
Last active August 29, 2015 14:17
Show Gist options
  • Save asterite/5710f02a0237e9d1bc64 to your computer and use it in GitHub Desktop.
Save asterite/5710f02a0237e9d1bc64 to your computer and use it in GitHub Desktop.
lib LibC
fun opendir(name : UInt8*) : Dir*
fun find_first_file = FindFirstFile(...) : Dir*
end
module LibCWrappers
def self.opendir(path)
ifdef windows
LibC.find_first_file(path, ...)
else
LibC.opendir(path)
end
end
end
class Dir
def initialize(@path)
@dir = LibCWrappers.opendir(@path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment