lib/sugarcube/document.rb in sugarcube-0.7 vs lib/sugarcube/document.rb in sugarcube-0.7.1
- old
+ new
@@ -1,12 +1,14 @@
class NSString
def document
- @docs ||= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0]
- @docs.stringByAppendingPathComponent(self)
+ @@docs ||= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0]
+ return self if self.hasPrefix(@@docs)
+
+ @@docs.stringByAppendingPathComponent(self)
end
def exists?
- NSFileManager.defaultManager.fileExistsAtPath(self)
+ NSFileManager.defaultManager.fileExistsAtPath(self.document)
end
end