Skip to content

Commit

Permalink
Fixes for Max and Win
Browse files Browse the repository at this point in the history
  • Loading branch information
hassec committed Jul 27, 2021
1 parent 01d80d6 commit 1469cde
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/makernote_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <pwd.h>
#else
#include <windows.h>
#include <direct.h> // _getcwd
#include <shlobj.h>
/* older SDKs not have these */
# ifndef CSIDL_MYMUSIC
Expand Down Expand Up @@ -109,12 +110,12 @@ namespace Exiv2 {

// first lets get the current working directory to check if there is a config file
#if defined(_MSC_VER) || defined(__MINGW__)
char path[MAX_PATH];
if (SUCCEEDED(GetModuleFileNameA(NULL, path, MAX_PATH))) {
dir = std::string(path);
}
char buffer[MAX_PATH];
auto path = _getcwd(buffer, sizeof(buffer));
dir = std::string(path ? path : "");
#else
auto path = get_current_dir_name();
char buffer[1024];
auto path = getcwd(buffer, sizeof(buffer));
dir = std::string(path ? path : "");
#endif
auto const filename = dir + EXV_SEPARATOR_CHR + inifile;
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions tests/lens_tests/test_config_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
import system_tests
import os
import shutil
import sys


# copy the example config file into current working directory
# and name it ".exiv2" on linux or "exiv2.ini" on Win
class TmpConfigFile(system_tests.FileDecoratorBase):
def setUp_file_action(self, expanded_file_name):
config_file_path = os.path.dirname(os.path.abspath(__file__))
fname = ".exiv2" if sys.platform == "linux" or sys.platform == "darwin" else "exiv2.ini"
return shutil.copyfile(expanded_file_name, os.path.join(config_file_path, fname))


@TmpConfigFile("$data_path/example_exiv2_config_file_for_lens_test")
class TestLensConfigFile(metaclass=system_tests.CaseMeta):
"""
Simple test for the configuration file based lens name resolution
Expand Down

0 comments on commit 1469cde

Please sign in to comment.