diff --git a/cogrc b/cogrc index bb156c8..500b98b 100644 --- a/cogrc +++ b/cogrc @@ -1,5 +1,5 @@ [version] -release_version=0.4 +release_version=0.5 [defaults] wine-path=wine diff --git a/include/bottles.hpp b/include/bottles.hpp index 28f7003..7348299 100644 --- a/include/bottles.hpp +++ b/include/bottles.hpp @@ -6,7 +6,7 @@ #include #include "commands.hpp" -#include "json.hpp" +#include "nlohmann/json.hpp" using namespace std; diff --git a/include/cellar.hpp b/include/cellar.hpp index 03e3da0..bd92402 100644 --- a/include/cellar.hpp +++ b/include/cellar.hpp @@ -4,7 +4,7 @@ #include #include -#include "json.hpp" +#include "nlohmann/json.hpp" #include "bottles.hpp" diff --git a/include/config.hpp b/include/config.hpp index 6b8f514..2836118 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -2,7 +2,7 @@ #define __CONFIG_HPP #pragma once -#include "json.hpp" +#include "nlohmann/json.hpp" using nlohmann::json; diff --git a/src/bottles/activate.cpp b/src/bottles/activate.cpp index dd9bfc7..192d7d5 100644 --- a/src/bottles/activate.cpp +++ b/src/bottles/activate.cpp @@ -22,7 +22,7 @@ void cellar::bottles::switch_active_bottle(int argc, vector argv) { string homepath = getenv("HOME"); // /home/nick string bottlepath = homepath + "/.wine"; // /home/nick/.wine - string targetpath = bottlepath + "." + argv[1]; // /home/nick/.wine.example + string targetpath = homepath + "/.local/share/cellar/bottles/" + argv[1]; // /home/nick/.wine.example file_status targetstatus = symlink_status(targetpath); if (!exists(targetstatus)) { diff --git a/src/bottles/active.cpp b/src/bottles/active.cpp index 91124cf..1b9e19a 100644 --- a/src/bottles/active.cpp +++ b/src/bottles/active.cpp @@ -12,20 +12,17 @@ using namespace cellar::bottles; void cellar::bottles::print_active_bottle(int argc, vector argv) { map bottlemap = get_bottles(); - if (bottlemap.find(".wine") == bottlemap.end()) { // not found - output::error("no active wine bottle"); - return; - } - Bottle active_bottle = bottlemap[".wine"]; + Bottle active_bottle = Bottle(getenv("HOME") + string("/.wine")); string bottlepath = active_bottle.canonical_path; stringstream outstr; bool cellar_managed = true; if (active_bottle.type == bottle_symlink) { outstr << "symlink to "; string homedir = getenv("HOME"); - if (active_bottle.canonical_path.substr(0, homedir.length()) == homedir) { - bottlepath.replace(0, homedir.length() + 1, ""); // should convert "/home/someone/.wine.example" to ".wine.example" + string bottlerack = homedir + "/.local/share/cellar/bottles"; + if (active_bottle.canonical_path.substr(0, bottlerack.length()) == bottlerack) { + bottlepath.replace(0, bottlerack.length() + 1, ""); // should convert "/home/someone/.wine.example" to ".wine.example" active_bottle = bottlemap[bottlepath]; } else { outstr << active_bottle.canonical_path; @@ -40,7 +37,7 @@ void cellar::bottles::print_active_bottle(int argc, vector argv) { outstr << "anonymous wine bottle at " << active_bottle.canonical_path; break; case bottle_labelled: - outstr << active_bottle.config["name"] << " (~/" << bottlepath << ")"; + outstr << active_bottle.config["name"] << " (" << bottlepath << ")"; if (active_bottle.config.find("desc") != active_bottle.config.end()) { outstr << " - " << active_bottle.config["desc"]; } diff --git a/src/bottles/bottles.cpp b/src/bottles/bottles.cpp index 58ec654..2354b32 100644 --- a/src/bottles/bottles.cpp +++ b/src/bottles/bottles.cpp @@ -7,7 +7,7 @@ #include #include -#include "json.hpp" +#include "nlohmann/json.hpp" #include "bottles.hpp" #include "internal/bottles.hpp" @@ -59,14 +59,12 @@ map cellar::bottles::get_bottles() { map result; string homepath = getenv("HOME"); - vector homedir = fs::listdir(homepath); + vector homedir = fs::listdir(homepath + "/.local/share/cellar/bottles"); for (string item : homedir) { - if (item.substr(0,5) == ".wine") { - string fullitem = homepath + "/" + item; - Bottle output(fullitem); + string fullitem = homepath + "/.local/share/cellar/bottles/" + item; + Bottle output(fullitem); - result[item] = output; - } + result[item] = output; } return result; @@ -85,13 +83,8 @@ string cellar::bottles::resolve_bottle(string bottlechoice) { output::warning("your shell didn't expand your given path properly, doing a naive replacement", true); result = bottlechoice; } else { - if (bottlechoice.substr(0,6) == ".wine.") { - output::statement("tip: cellar can add the \".wine.\" prefix automatically"); - bottlechoice.replace(0,6,""); - } - string homepath = getenv("HOME"); - string fullbottlepath = homepath + "/.wine." + bottlechoice; + string fullbottlepath = homepath + "/.local/share/cellar/bottles" + bottlechoice; result = fullbottlepath; } return result; @@ -103,8 +96,8 @@ void cellar::bottles::print_bottles(int argc, vector argv) { stringstream outstr; for (auto item : bottles) { - if (item.first == ".wine" || item.first == ".wine.template") { - // .wine is considered to be "active", and .wine.template is used as a template + if (item.first == ".wine" || item.first == ".local/share/cellar/bottles/template") { + // .wine is considered to be "active", and .local/share/cellar/bottles/template is used as a template // and therefore treated specially continue; } diff --git a/src/bottles/cork.cpp b/src/bottles/cork.cpp index 86d688d..678e642 100644 --- a/src/bottles/cork.cpp +++ b/src/bottles/cork.cpp @@ -7,7 +7,7 @@ #include #include #include -#include "json.hpp" +#include "nlohmann/json.hpp" #include "bottles.hpp" #include "internal/bottles.hpp" diff --git a/src/bottles/create.cpp b/src/bottles/create.cpp index b70dbe4..f17e5c3 100644 --- a/src/bottles/create.cpp +++ b/src/bottles/create.cpp @@ -45,12 +45,7 @@ void cellar::bottles::create_bottle(int argc, vector argv) { output::warning("your shell didn't expand your given path properly, doing a naive replacement", true); fullbottlepath = bottlechoice; } else { - if (bottlechoice.substr(0,6) == ".wine.") { - output::statement("tip: cellar can add the \".wine.\" prefix automatically"); - bottlechoice.replace(0,6,""); - } - - fullbottlepath = homepath + "/.wine." + bottlechoice; + fullbottlepath = homepath + "/.local/share/cellar/bottles/" + bottlechoice; } if (boost::filesystem::exists(fullbottlepath)) { @@ -58,13 +53,13 @@ void cellar::bottles::create_bottle(int argc, vector argv) { return; } - if (fullbottlepath != homepath + "/.wine.template") { + if (fullbottlepath != homepath + "/.local/share/cellar/bottles/template") { output::statement("copying template bottle to " + fullbottlepath, true); // all this gets skipped if we're creating the template bottle - if (boost::filesystem::exists(homepath + "/.wine.template")) { + if (boost::filesystem::exists(homepath + "/.local/share/cellar/bottles/template")) { if (!dryrun) { - fs::recursive_copy(homepath + "/.wine.template", fullbottlepath); + fs::recursive_copy(homepath + "/.local/share/cellar/bottles/template", fullbottlepath); return; } } else { diff --git a/src/bottles/press.cpp b/src/bottles/press.cpp index 5f75f8b..30f9436 100644 --- a/src/bottles/press.cpp +++ b/src/bottles/press.cpp @@ -4,7 +4,7 @@ #include #include -#include "json.hpp" +#include "nlohmann/json.hpp" #include "bottles.hpp" #include "cellar.hpp" diff --git a/src/bottles/remove.cpp b/src/bottles/remove.cpp index 0556401..55c06f8 100644 --- a/src/bottles/remove.cpp +++ b/src/bottles/remove.cpp @@ -22,12 +22,7 @@ void cellar::bottles::remove_bottle(int argc, vector argv) { output::error("paths not accepted"); return; } else { - if (bottlechoice.substr(0,6) == ".wine.") { - output::statement("tip: cellar can add the \".wine.\" prefix automatically"); - bottlechoice.replace(0,6,""); - } - - fullbottlepath = homepath + "/.wine." + bottlechoice; + fullbottlepath = homepath + "/.local/share/cellar/bottles/" + bottlechoice; } if (!boost::filesystem::exists(fullbottlepath)) { diff --git a/src/cellar.cpp.cog b/src/cellar.cpp.cog index 97ba7ce..b1bfba4 100644 --- a/src/cellar.cpp.cog +++ b/src/cellar.cpp.cog @@ -5,9 +5,9 @@ #include #include -#include "config.h" +#include "config.hpp" #include "tclap/CmdLine.h" -#include "json.hpp" +#include "nlohmann/json.hpp" #include "bottles.hpp" #include "cellar.hpp" diff --git a/src/config/defaults.cpp.cog b/src/config/defaults.cpp.cog index 36e77c3..20194c0 100644 --- a/src/config/defaults.cpp.cog +++ b/src/config/defaults.cpp.cog @@ -1,6 +1,6 @@ // vim: ft=cpp : -#include "json.hpp" +#include "nlohmann/json.hpp" #include "config.hpp" diff --git a/src/config/save_load.cpp b/src/config/save_load.cpp index 82c9c68..b19fbdb 100644 --- a/src/config/save_load.cpp +++ b/src/config/save_load.cpp @@ -4,7 +4,7 @@ #include #include -#include "json.hpp" +#include "nlohmann/json.hpp" #include "cellar.hpp" #include "config.hpp"