Fixes for Max and Win
This commit is contained in:
parent
aa86646f27
commit
95c2c26747
@ -51,6 +51,7 @@
|
||||
#include <pwd.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <direct.h> // _getcwd
|
||||
#include <shlobj.h>
|
||||
/* older SDKs not have these */
|
||||
# ifndef CSIDL_MYMUSIC
|
||||
@ -113,12 +114,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;
|
||||
|
||||
@ -2,7 +2,19 @@ import unittest
|
||||
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user