now handles symlinks
This commit is contained in:
parent
f69095d7ab
commit
05eeca49c9
@ -26,7 +26,18 @@ vector<string> cellar::bottles::list() {
|
||||
sstr_output << item;
|
||||
sstr_output << " ";
|
||||
|
||||
string jsonpath = homepath + "/" + item + "/cellar.json";
|
||||
string fullitem = homepath + "/" + item;
|
||||
boost::filesystem::file_status fullitem_status = boost::filesystem::symlink_status(fullitem);
|
||||
bool symlink = boost::filesystem::is_symlink(fullitem_status);
|
||||
|
||||
if (symlink) {
|
||||
sstr_output << "- symlink to ";
|
||||
boost::filesystem::path realpath = boost::filesystem::canonical(fullitem);
|
||||
sstr_output << realpath.string();
|
||||
result.push_back(sstr_output.str());
|
||||
sstr_output.str("");
|
||||
} else {
|
||||
string jsonpath = fullitem + "/cellar.json";
|
||||
if (boost::filesystem::exists(jsonpath)) {
|
||||
try {
|
||||
json config;
|
||||
@ -52,6 +63,7 @@ vector<string> cellar::bottles::list() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user