lib/buzztools/file.rb in buzztools-0.0.7 vs lib/buzztools/file.rb in buzztools-0.0.8

- old
+ new

@@ -46,10 +46,16 @@ def path_rebase(aPath,aOldBase,aNewBase) rel_path = path_debase(aPath,aOldBase) append_slash(aNewBase)+rel_path end + def path_relative?(aPath) + return false if aPath[0,1]=='/' + return false if aPath =~ /^[a-zA-Z]:/ + return true + end + def path_combine(aBasePath,aPath) return aBasePath if !aPath return aPath if !aBasePath return path_relative?(aPath) ? ::File.join(aBasePath,aPath) : aPath end @@ -80,11 +86,12 @@ def expand_magic_path(aPath,aBasePath=nil) aBasePath ||= Dir.pwd path = aPath if path.begins_with?('...') rel_part = path.split3(/\.\.\.[\/\\]/)[2] - path = find_upwards(aBasePath,rel_part) + return find_upwards(aBasePath,rel_part) end + path_combine(aBasePath,aPath) end def path_parent(aPath) return nil if is_root_path?(aPath) append_slash(::File.dirname(remove_slash(expand_path(aPath)))) \ No newline at end of file