Created
February 10, 2011 10:47
-
-
Save kourge/820296 to your computer and use it in GitHub Desktop.
MacFUSE fs in MacRuby, with custom volume icon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
framework 'cocoa' | |
class HelloFS | |
PATH = '/hello.txt' | |
def contentsOfDirectoryAtPath(path, error: error) | |
[PATH.lastPathComponent] | |
end | |
def contentsAtPath(path) | |
return nil unless path == PATH | |
"Hello World!\n".dataUsingEncoding(NSUTF8StringEncoding) | |
end | |
end | |
mountpoint = File.expand_path(ARGV.first || "/Volumes/Hello") | |
icon = File.expand_path("~/Desktop/fsicon.icns") | |
d = HelloFS.new | |
framework 'macfuse' | |
fs = GMUserFileSystem.alloc.initWithDelegate(d, isThreadSafe: true) | |
puts "GMUserFileSystem initialized" | |
fs.mountAtPath(mountpoint, withOptions: [ | |
'rdonly', 'volname=HelloFS', "volicon=#{icon}" | |
]) | |
at_exit { fs.unmount } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment