.gitignore, beginning of cellar.json support
This commit is contained in:
parent
107c00f769
commit
e30cddee84
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
*.in
|
||||||
|
*.o
|
||||||
|
*/.deps
|
||||||
|
|
||||||
|
compile
|
||||||
|
config.*
|
||||||
|
configure
|
||||||
|
depcomp
|
||||||
|
install-sh
|
||||||
|
missing
|
@ -1,20 +1,44 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
|
#include "json.hpp"
|
||||||
|
|
||||||
#include "fs.hpp"
|
#include "fs.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
vector<string> homedir = cellar::fs::listdir(getenv("HOME"));
|
string homepath = getenv("HOME");
|
||||||
|
vector<string> homedir = cellar::fs::listdir(homepath);
|
||||||
for (string item : homedir) {
|
for (string item : homedir) {
|
||||||
cout << item;
|
if (item.substr(0,5) == ".wine") {
|
||||||
cout << " ";
|
cout << item;
|
||||||
|
cout << " ";
|
||||||
|
|
||||||
|
string jsonpath = homepath + "/" + item + "/cellar.json";
|
||||||
|
if (boost::filesystem::exists(jsonpath)) {
|
||||||
|
try {
|
||||||
|
json config;
|
||||||
|
ifstream configstream(jsonpath);
|
||||||
|
stringstream sstr;
|
||||||
|
sstr << configstream.rdbuf();
|
||||||
|
config = json::parse(sstr.str());
|
||||||
|
|
||||||
|
cout << "has a json" << endl;
|
||||||
|
}
|
||||||
|
catch (const exception &exc) {
|
||||||
|
cout << "- bogus cellar.json file" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { cout << "- anonymous wine bottle" << endl; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user