File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ Official Source Code: https://github.com/wsjcpp/wsjcpp-yaml
2727#include < vector>
2828#include < iostream>
2929#include < cmath>
30+ #include < fstream>
3031#include < wsjcpp_yaml.h>
3132
3233#ifdef WINDOWS
@@ -41,9 +42,15 @@ int main() {
4142 char buff[FILENAME_MAX];
4243 GetCurrentDir (buff, FILENAME_MAX );
4344 std::cout << " Current path: " << buff << std::endl;
44-
45+ std::string sFilepath = " ../../../src/tests/data-tests/float-double/example.yml" ;
46+ // find path
47+ {
48+ std::ifstream file_ (sFilepath .c_str ());
49+ if (!file_) {
50+ sFilepath = " ../" + sFilepath ;
51+ }
52+ }
4553 WsjcppYaml yaml;
46- std::string sFilepath = " ../../../../src/tests/data-tests/float-double/example.yml" ;
4754 std::string sError ;
4855 if (!yaml.loadFromFile (sFilepath , sError )) {
4956 std::cerr << " Error parsing: " << sError << std::endl;
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ Official Source Code: https://github.com/wsjcpp/wsjcpp-yaml
2727#include < vector>
2828#include < iostream>
2929#include < cmath>
30+ #include < fstream>
3031#include < wsjcpp_yaml.h>
3132
3233#ifdef WINDOWS
@@ -41,9 +42,16 @@ int main() {
4142 char buff[FILENAME_MAX];
4243 GetCurrentDir (buff, FILENAME_MAX);
4344 std::cout << " Current path: " << buff << std::endl;
45+ std::string sFilepath = " ../../../src/tests/data-tests/float-double/example.yml" ;
46+ // find path
47+ {
48+ std::ifstream file_ (sFilepath .c_str ());
49+ if (!file_) {
50+ sFilepath = " ../" + sFilepath ;
51+ }
52+ }
4453
4554 WsjcppYaml yaml;
46- std::string sFilepath = " ../../../../src/tests/data-tests/float-double/example.yml" ;
4755 std::string sError ;
4856 if (!yaml.loadFromFile (sFilepath , sError )) {
4957 std::cerr << " Error parsing: " << sError << std::endl;
Original file line number Diff line number Diff line change @@ -25,12 +25,21 @@ Official Source Code: https://github.com/wsjcpp/wsjcpp-yaml
2525*/
2626
2727#include < iostream>
28+ #include < fstream>
2829#include < wsjcpp_yaml.h>
2930#include " get_current_rss.h"
3031#include " process_mem_usage.h"
3132
3233int createManyTimesObjects () {
33- const std::string sFilepath = " ../../../../src/tests/data-tests/for-memory-leak/some.yml" ;
34+ std::string sFilepath = " ../../../src/tests/data-tests/for-memory-leak/some.yml" ;
35+ // find path
36+ {
37+ std::ifstream file_ (sFilepath .c_str ());
38+ if (!file_) {
39+ sFilepath = " ../" + sFilepath ;
40+ }
41+ }
42+
3443 std::string sError ;
3544 for (int i = 0 ; i < 10000 ; i++) {
3645 WsjcppYaml yaml;
Original file line number Diff line number Diff line change @@ -30,8 +30,24 @@ Official Source Code: https://github.com/wsjcpp/wsjcpp-yaml
3030#include < wsjcpp_yaml.h>
3131
3232int main () {
33- std::string sFilepath = " ../../../../src/tests/data-tests/read-write-file/docker-compose.yml" ;
34- std::string sFilepathOutput = " ../../../../src/tests/data-tests/read-write-file/docker-compose.output.yml" ;
33+ std::string sFilepath = " ../../../src/tests/data-tests/read-write-file/docker-compose.yml" ;
34+ // find path
35+ {
36+ std::ifstream file_ (sFilepath .c_str ());
37+ if (!file_) {
38+ sFilepath = " ../" + sFilepath ;
39+ }
40+ }
41+
42+ std::string sFilepathOutput = " ../../../src/tests/data-tests/read-write-file/docker-compose.output.yml" ;
43+ // find path
44+ {
45+ std::ifstream file_ (sFilepathOutput .c_str ());
46+ if (!file_) {
47+ sFilepathOutput = " ../" + sFilepathOutput ;
48+ }
49+ }
50+
3551 WsjcppYaml yaml;
3652 std::string sError ;
3753 if (!yaml.loadFromFile (sFilepath , sError )) {
Original file line number Diff line number Diff line change @@ -25,10 +25,19 @@ Official Source Code: https://github.com/wsjcpp/wsjcpp-yaml
2525*/
2626
2727#include < iostream>
28+ #include < fstream>
2829#include < wsjcpp_yaml.h>
2930
3031int main () {
31- std::string sFilepath = " ../../../../src/tests/data-tests/remove-element-from-array.yml" ;
32+ std::string sFilepath = " ../../../src/tests/data-tests/remove-element-from-array.yml" ;
33+ // find path
34+ {
35+ std::ifstream file_ (sFilepath .c_str ());
36+ if (!file_) {
37+ sFilepath = " ../" + sFilepath ;
38+ }
39+ }
40+
3241 WsjcppYaml yaml;
3342 std::string sError ;
3443 if (!yaml.loadFromFile (sFilepath , sError )) {
You can’t perform that action at this time.
0 commit comments