Fixes for Max and Win

main
Christoph Hasse 4 years ago
parent aa86646f27
commit 95c2c26747

@ -51,6 +51,7 @@
#include <pwd.h> #include <pwd.h>
#else #else
#include <windows.h> #include <windows.h>
#include <direct.h> // _getcwd
#include <shlobj.h> #include <shlobj.h>
/* older SDKs not have these */ /* older SDKs not have these */
# ifndef CSIDL_MYMUSIC # ifndef CSIDL_MYMUSIC
@ -113,12 +114,12 @@ namespace Exiv2 {
// first lets get the current working directory to check if there is a config file // first lets get the current working directory to check if there is a config file
#if defined(_MSC_VER) || defined(__MINGW__) #if defined(_MSC_VER) || defined(__MINGW__)
char path[MAX_PATH]; char buffer[MAX_PATH];
if (SUCCEEDED(GetModuleFileNameA(NULL, path, MAX_PATH))) { auto path = _getcwd(buffer, sizeof(buffer));
dir = std::string(path); dir = std::string(path ? path : "");
}
#else #else
auto path = get_current_dir_name(); char buffer[1024];
auto path = getcwd(buffer, sizeof(buffer));
dir = std::string(path ? path : ""); dir = std::string(path ? path : "");
#endif #endif
auto const filename = dir + EXV_SEPARATOR_CHR + inifile; auto const filename = dir + EXV_SEPARATOR_CHR + inifile;

@ -2,7 +2,19 @@ import unittest
import system_tests import system_tests
import os import os
import shutil 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): class TestLensConfigFile(metaclass=system_tests.CaseMeta):
""" """
Simple test for the configuration file based lens name resolution Simple test for the configuration file based lens name resolution

Loading…
Cancel
Save