#include <iostream>
using namespace std;
int main (int argc, char * argv[]) {
cout << "the address is: " << argv [0] << endl;
return 0;
}
W POWER SHELL ten kod zwraca pełną ścieżkę
w CMD i BASH kod zwraca ścieżkę jaka została użyta do uruchomienia
Potrzebuję ścieżkę do folderu w której jest uruchomiona aplikacja
Czy taka koncepcja jest słuszna ?
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main(int argc, char * argv[])
{
// std::cout << "current_path = " << fs::current_path() << '\n';
// std::cout << "argv[0] = " << argv[0]<< '\n';
auto full_path = fs::current_path();
full_path /= argv[0]; // jak argv[0] jest ablsolutne to nadpisze wartosc jak nie to doda
std::cout << "*** full_path_to_APP = " << full_path << '\n';
std::cout << "*** full_path_to_DIR = "<< full_path.parent_path() << '\n';
}