Aniseto / NosoWalletCPP

Noso Wallet implementation in C++
https://www.nosocoin.com
MIT License
2 stars 1 forks source link

Fixes the path issues with data/sumary.psk #8

Closed gcarreno closed 1 year ago

gcarreno commented 1 year ago

Hey @Aniseto,

I've fixed the path issues with data/sumary.psk.

I've added:

#include <filesystem>
namespace fs = std::filesystem;

and made some adjustments with the type of container for the path. From wxString to std::string which is what current_path() returns, I think...

Side Note: The program is creating the data folder with permissiion drw-r--r--, when it should be drwxrwxr-x. This is a Linux only issue and I need to confer with @Azazorro to find a way to avoid/fix this.

Cheers, Gus

Aniseto commented 1 year ago

Testing this PR, std::current_path() is not identified as a valid member for std.

gcarreno commented 1 year ago

Hey @Aniseto,

std::current_path() is not identified as a valid member for std.

You are completely correct, current_path() does not belong on the std namespace.

If you look closely at the message on the PR, the one at the top there :arrow_up:, you'll notice that it belongs to std::filesystem for which I've created an alias called fs.

So in order to use it you just have to do something like this:

std::string filename = fs::current_path() / "data" / "sumario.psk";

And then use that variable to send to the reader function.

Hope that helps!

Cheers, Gus

Aniseto commented 1 year ago

The issue is that compiler says:

About this line: std::string outputDir = fs::current_path() / "";

Error (active) E0312 no suitable user-defined conversion from "std::filesystem::path" to "std::string" exists NosoWalletCPP

std::string outputDir = fs::current_path().string() / "";

gcarreno commented 1 year ago

Hey @Aniseto,

Wow, that's quite odd!!

I tested that on my Linux box with g++ and it worked. But I did wonder why because the docs did say that current_path() returned path. I was a bit in a hurry and forgot that it std::filesystem::path so I tried std::string and it worked on my end. Let me update the PR to reflect this change.

Cheers, Gus

gcarreno commented 1 year ago

Hey @Aniseto,

Looks like fs::path has a function that returns a string.

I made the necessary changes to always have a path return a string. Please review them and see if it works on your side now.

Cheers, Gus

Aniseto commented 1 year ago

Solved path issue, changing from wxString to std::String. Not needed to merge.