add back includes

This commit is contained in:
SCG82 2020-01-04 04:19:51 -08:00
parent 2603a0c0bc
commit e5849e59b9
6 changed files with 66 additions and 23 deletions

View File

@ -1,6 +1,22 @@
#include "Dependency.h"
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <locale>
#include <sstream>
#include <vector>
// #include <stdlib.h>
#include <sys/param.h>
// #include <sys/stat.h>
#ifndef __clang__
#include <sys/types.h>
#endif
#include <unistd.h>
#include "Settings.h"
#include "Utils.h"

View File

@ -1,11 +1,18 @@
#include "DylibBundler.h"
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#ifdef __linux
#include <linux/limits.h>
#endif
#ifndef __clang__
#include <sys/types.h>
#endif
#include "Dependency.h"
#include "Settings.h"
@ -282,7 +289,7 @@ void copyQtPlugins()
fixupPlugin("imageformats");
fixupPlugin("iconengines");
if (!qtSvgFound)
systemp("rm -f " + dest + "imageformats/libqsvg.dylib");
systemp(std::string("rm -f ") + dest + "imageformats/libqsvg.dylib");
if (qtGuiFound) {
fixupPlugin("platforminputcontexts");
fixupPlugin("virtualkeyboard");

View File

@ -1,7 +1,10 @@
#include "Settings.h"
#include <cstdlib>
#include <map>
#include <sys/param.h>
#include "Utils.h"
namespace Settings {
@ -56,17 +59,14 @@ void appBundle(std::string path)
std::string destFolder() { return dest_path; }
void destFolder(std::string path)
{
if (path[path.size()-1] != '/')
path += "/";
dest_folder = path;
if (appBundleProvided()) {
char buffer[PATH_MAX];
dest_path = path;
if (appBundleProvided())
dest_path = app_bundle + "Contents/" + stripLSlash(dest_folder);
if (realpath(dest_path.c_str(), buffer))
dest_path = buffer;
if (dest_path[dest_path.size()-1] != '/')
dest_path += "/";
}
char buffer[PATH_MAX];
if (realpath(dest_path.c_str(), buffer))
dest_path = buffer;
if (dest_path[dest_path.size()-1] != '/')
dest_path += "/";
}
std::string executableFolder() { return app_bundle + "Contents/MacOS/"; }
@ -127,13 +127,13 @@ bool isPrefixBundled(std::string prefix)
std::vector<std::string> searchPaths;
void addSearchPath(std::string path) { searchPaths.push_back(path); }
size_t searchPathCount() { return searchPaths.size(); }
std::string searchPath(const int n) { return searchPaths[n]; }
size_t searchPathCount() { return searchPaths.size(); }
std::vector<std::string> userSearchPaths;
void addUserSearchPath(std::string path) { userSearchPaths.push_back(path); }
size_t userSearchPathCount() { return userSearchPaths.size(); }
std::string userSearchPath(const int n) { return userSearchPaths[n]; }
size_t userSearchPathCount() { return userSearchPaths.size(); }
bool canCreateDir() { return create_dir; }
void canCreateDir(bool permission) { create_dir = permission; }

View File

@ -6,6 +6,10 @@
#include <string>
#include <vector>
#ifndef __clang__
#include <sys/types.h>
#endif
namespace Settings {
bool isPrefixBundled(std::string prefix);
@ -33,12 +37,12 @@ std::string insideLibPath();
void insideLibPath(std::string p);
void addSearchPath(std::string path);
size_t searchPathCount();
std::string searchPath(int n);
size_t searchPathCount();
void addUserSearchPath(std::string path);
size_t userSearchPathCount();
std::string userSearchPath(int n);
size_t userSearchPathCount();
bool canCreateDir();
void canCreateDir(bool permission);

View File

@ -1,10 +1,18 @@
#include "Utils.h"
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <regex>
#include <sstream>
// #include <stdio.h>
#include <sys/param.h>
// #include <sys/stat.h>
#ifndef __clang__
#include <sys/types.h>
#endif
#include <unistd.h>
#include "Settings.h"
@ -172,9 +180,8 @@ void copyFile(const std::string& from, const std::string& to)
exit(1);
}
std::string overwrite_permission = std::string(overwrite ? "-f " : "-n ");
// copy file/directory
std::string overwrite_permission = std::string(overwrite ? "-f " : "-n ");
std::string command = std::string("cp -R ") + overwrite_permission + from + std::string(" ") + to;
if (from != to && systemp(command) != 0) {
std::cerr << "\n\nError: An error occured while trying to copy file " << from << " to " << to << std::endl;
@ -208,7 +215,7 @@ void deleteFile(const std::string& path)
bool mkdir(const std::string& path)
{
if (Settings::verboseOutput())
std::cout << "* Creating directory " << path << "\n\n";
std::cout << "Creating directory " << path << std::endl;
std::string command = std::string("mkdir -p ") + path;
if (systemp(command) != 0) {
std::cerr << "\n/!\\ ERROR: An error occured while creating " << path << std::endl;
@ -221,12 +228,12 @@ void createDestDir()
{
std::string dest_folder = Settings::destFolder();
if (Settings::verboseOutput())
std::cout << "* Checking output directory " << dest_folder << "\n";
std::cout << "Checking output directory " << dest_folder << "\n";
bool dest_exists = fileExists(dest_folder);
if (dest_exists && Settings::canOverwriteDir()) {
std::cout << "* Erasing old output directory " << dest_folder << "\n";
std::cout << "Erasing old output directory " << dest_folder << "\n";
std::string command = std::string("rm -r ") + dest_folder;
if (systemp(command) != 0) {
std::cerr << "\n\n/!\\ ERROR: An error occured while attempting to overwrite destination folder\n";
@ -237,7 +244,7 @@ void createDestDir()
if (!dest_exists) {
if (Settings::canCreateDir()) {
std::cout << "* Creating output directory " << dest_folder << "\n\n";
std::cout << "Creating output directory " << dest_folder << "\n\n";
if (!mkdir(dest_folder)) {
std::cerr << "\n/!\\ ERROR: An error occured while creating " << dest_folder << std::endl;
exit(1);

View File

@ -1,9 +1,18 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string.h>
#ifndef __clang__
#include <sys/types.h>
#endif
#include "DylibBundler.h"
#include "Settings.h"
const std::string VERSION = "2.0.0 (2019-12-29)";
const std::string VERSION = "2.1.0 (2020-01-04)";
void showHelp()
{
@ -114,7 +123,7 @@ int main(int argc, const char* argv[])
exit(0);
}
std::cout << "* Collecting dependencies...\n";
std::cout << "Collecting dependencies...\n";
const size_t files_count = Settings::filesToFixCount();