Skip to content

Instantly share code, notes, and snippets.

@teramako
Created December 22, 2009 12:22
Show Gist options
  • Save teramako/261710 to your computer and use it in GitHub Desktop.
Save teramako/261710 to your computer and use it in GitHub Desktop.
var root = io.File("~/hoge");
var target = io.File("~/var");
var path="";
while (root.parent){
print(root.path);
if (target.path.indexOf(root.path) == 0){
break;
}
root = root.parent;
path += "../";
}
path += target.path.substring(root.path.length + 1);
print("=====");
print(path);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment