aboutsummaryrefslogtreecommitdiff
path: root/src/PkgConfig.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-09-25 23:22:08 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:33 +0200
commitdbb06eac9bae1b8dbc50275b66c975da09b1d09a (patch)
tree4cfa3cc326a11aa8cd8b7ff83d8afb1b2754f150 /src/PkgConfig.cpp
parentc4d1491af938a12a0167dae4fd3ea8f1810c752a (diff)
Fix build with msvc (windows)
Fix freeze when sub process (exec) returns a lot of data (in stdout)
Diffstat (limited to 'src/PkgConfig.cpp')
-rw-r--r--src/PkgConfig.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/PkgConfig.cpp b/src/PkgConfig.cpp
index 3a36f39..faed146 100644
--- a/src/PkgConfig.cpp
+++ b/src/PkgConfig.cpp
@@ -1,5 +1,4 @@
#include "../include/PkgConfig.hpp"
-#if OS_FAMILY == OS_FAMILY_POSIX
#include "../include/Exec.hpp"
#include "../include/Dependency.hpp"
@@ -35,9 +34,9 @@ namespace sibs
Result<bool> PkgConfig::validatePackageExists(const string &name)
{
- string command = "pkg-config --exists '";
- command += name;
- command += "'";
+ FileString command = TINYDIR_STRING("pkg-config --exists '");
+ command += toFileString(name);
+ command += TINYDIR_STRING("'");
Result<ExecResult> execResult = exec(command.c_str());
if(execResult.isErr())
return Result<bool>::Err(execResult.getErrMsg());
@@ -69,11 +68,11 @@ namespace sibs
// Use --modversion instead and check if the version returned is newer or equal to dependency version.
// This way we can output installed version vs expected dependency version
- string command = "pkg-config '--atleast-version=";
- command += version;
- command += "' '";
- command += name;
- command += "'";
+ FileString command = TINYDIR_STRING("pkg-config '--atleast-version=");
+ command += toFileString(version);
+ command += TINYDIR_STRING("' '");
+ command += toFileString(name);
+ command += TINYDIR_STRING("'");
Result<ExecResult> execResult = exec(command.c_str());
if(execResult.isErr())
return Result<bool>::Err(execResult.getErrMsg());
@@ -112,8 +111,8 @@ namespace sibs
args += "'";
}
- string command = "pkg-config --libs";
- command += args;
+ FileString command = TINYDIR_STRING("pkg-config --libs");
+ command += toFileString(args);
Result<ExecResult> execResult = exec(command.c_str());
if(execResult.isErr())
return Result<string>::Err(execResult.getErrMsg());
@@ -155,8 +154,8 @@ namespace sibs
args += "'";
}
- string command = "pkg-config --cflags";
- command += args;
+ FileString command = TINYDIR_STRING("pkg-config --cflags");
+ command += toFileString(args);
Result<ExecResult> execResult = exec(command.c_str());
if(execResult.isErr())
return Result<string>::Err(execResult.getErrMsg());
@@ -202,5 +201,4 @@ namespace sibs
flags.cflags = move(cflagsResult.unwrap());
return Result<PkgConfigFlags>::Ok(flags);
}
-}
-#endif // OS_FAMILY_POSIX
+} \ No newline at end of file