move cellar bottles to .local/share
This commit is contained in:
parent
89998bada1
commit
429b19abee
2
cogrc
2
cogrc
@ -1,5 +1,5 @@
|
||||
[version]
|
||||
release_version=0.4
|
||||
release_version=0.5
|
||||
|
||||
[defaults]
|
||||
wine-path=wine
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "commands.hpp"
|
||||
#include "json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include "bottles.hpp"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __CONFIG_HPP
|
||||
#pragma once
|
||||
|
||||
#include "json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
|
@ -22,7 +22,7 @@ void cellar::bottles::switch_active_bottle(int argc, vector<string> 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)) {
|
||||
|
@ -12,20 +12,17 @@ using namespace cellar::bottles;
|
||||
|
||||
void cellar::bottles::print_active_bottle(int argc, vector<string> argv) {
|
||||
map<string, Bottle> 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<string> 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"];
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include "json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include "bottles.hpp"
|
||||
#include "internal/bottles.hpp"
|
||||
@ -59,14 +59,12 @@ map<string, Bottle> cellar::bottles::get_bottles() {
|
||||
map<string, Bottle> result;
|
||||
|
||||
string homepath = getenv("HOME");
|
||||
vector<string> homedir = fs::listdir(homepath);
|
||||
vector<string> 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<string> 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;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include "json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include "bottles.hpp"
|
||||
#include "internal/bottles.hpp"
|
||||
|
@ -45,12 +45,7 @@ void cellar::bottles::create_bottle(int argc, vector<string> 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<string> 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 {
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include "json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include "bottles.hpp"
|
||||
#include "cellar.hpp"
|
||||
|
@ -22,12 +22,7 @@ void cellar::bottles::remove_bottle(int argc, vector<string> 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)) {
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "config.h"
|
||||
#include "config.hpp"
|
||||
#include "tclap/CmdLine.h"
|
||||
#include "json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include "bottles.hpp"
|
||||
#include "cellar.hpp"
|
||||
|
@ -1,6 +1,6 @@
|
||||
// vim: ft=cpp :
|
||||
|
||||
#include "json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include "json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include "cellar.hpp"
|
||||
#include "config.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user