Skip to content

Commit

Permalink
fix APPDIR env bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wenli7363 committed Dec 21, 2023
1 parent facd9ae commit 32d2f73
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ZpodsLib/src/base/compress.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ struct fmt::formatter<Code>
template <typename FormatContext>
auto format(const Code& p, FormatContext& ctx) const
{
return format_to(ctx.out(), "0b{:0{}b}", p.bits, p.len);
return fmt::format_to(ctx.out(), "0b{:0{}b}", p.bits, p.len);
}
};

Expand Down
2 changes: 1 addition & 1 deletion ZpodsLib/src/core/zpods_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ struct fmt::formatter<zpods::Pea>
template <typename FormatContext>
auto format(const zpods::Pea& p, FormatContext& ctx) const
{
return format_to(ctx.out(), "rel_path: {}, last_modified_ts: {}",
return fmt::format_to(ctx.out(), "rel_path: {}, last_modified_ts: {}",
p.rel_path, p.last_modified_ts);
}
};
Expand Down
8 changes: 7 additions & 1 deletion network/client/grpc_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ ABSL_FLAG(std::string, target, "127.0.0.1:50051", "Server address");
auto MakeClientSslCredentials()
{
auto ReadFile = [](const std::string& filename) {
let filepath = zpods::fs::path(getenv("APPDIR")) / filename;
let filepath = filename;

const char* appDir = getenv("APPDIR");
if(appDir != nullptr)
{
filepath = zpods::fs::path(getenv("APPDIR")) / filename;
}

std::ifstream file(filepath);
std::stringstream buffer;
Expand Down
2 changes: 2 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

mkdir tmp
cd build
./ZpodsLib/test/zpods_lib_test
cd ..
rm -rf tmp

0 comments on commit 32d2f73

Please sign in to comment.