Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/cli/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace {
}

std::string createAndGetAppDir(std::string dir) {
std::string home;
std::string home, xdg_data_home;
#ifdef _WIN32
if (dir.empty()) {
if (!std::getenv("HOMEDRIVE") || !std::getenv("HOMEPATH"))
Expand All @@ -44,7 +44,27 @@ std::string createAndGetAppDir(std::string dir) {
if (!std::getenv("HOME"))
return "";
home = std::getenv("HOME");
#ifdef __linux__
if (!std::getenv("XDG_DATA_HOME")) {
xdg_data_home = home + "/.local/share";
} else {
xdg_data_home = std::getenv("XDG_DATA_HOME");
}
dir = xdg_data_home + "/bredbandskollen";
// Make sure xdg_data_home exists
for (
size_t end = xdg_data_home.find('/', 1), prev = 0;
prev != std::string::npos;
prev = end, end = xdg_data_home.find('/', end+1)
) {
if(mkdir(xdg_data_home.substr(0, end).c_str(), 0755) && errno != EEXIST) {
return "";
}
};
#else
// Fall back to $HOME for other platforms
dir = home + "/.bredbandskollen";
#endif
}
int status = mkdir(dir.c_str(), 0755);
if (status && errno != EEXIST) {
Expand Down
1 change: 1 addition & 0 deletions src/http/httphost.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include <string>
#include <cstdint>

class CookieManager;

Expand Down
1 change: 1 addition & 0 deletions src/http/sha1.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <iostream>
#include <string>
#include <cstdint>

void base64_encode(const unsigned char *src, size_t len, char *destination);

Expand Down