diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2009-06-12 08:27:21 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2009-06-12 08:27:21 +0000 |
| commit | ec5e546220aadc938aace0fb9cb58dfa271ff15e (patch) | |
| tree | edcacfe93dbd27bc567908a805319568e516080f /src | |
| parent | Mark areas with charset conversion issues (diff) | |
| download | inkscape-ec5e546220aadc938aace0fb9cb58dfa271ff15e.tar.gz inkscape-ec5e546220aadc938aace0fb9cb58dfa271ff15e.zip | |
Cleaning up icc profile locations and adding OS X and Windows specifics. Work for bug #214198.
(bzr r8058)
Diffstat (limited to 'src')
| -rw-r--r-- | src/color-profile.cpp | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 20e870242..5868a9582 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -12,6 +12,10 @@ #include <cstring> #include <string> +// #ifdef WIN32 +// #include <windows.h> +// #include <Icm.h> +// #endif #include "xml/repr.h" #include "color-profile.h" #include "color-profile-fns.h" @@ -23,6 +27,7 @@ #include "dom/uri.h" #include "dom/util/digest.h" + using Inkscape::ColorProfile; using Inkscape::ColorProfileClass; @@ -578,13 +583,43 @@ std::list<Glib::ustring> ColorProfile::getProfileDirs() { // first try user's local dir sources.push_back( g_build_filename(g_get_user_data_dir(), "color", "icc", NULL) ); - sources.push_back( g_build_filename(base, ".color", "icc", NULL) ); // OpenICC recommends to deprecate this + const gchar* const * dataDirs = g_get_system_data_dirs(); for ( int i = 0; dataDirs[i]; i++ ) { - sources.push_back(g_build_filename(dataDirs[i], "color", "icc", NULL)); + gchar* path = g_build_filename(dataDirs[i], "color", "icc", NULL); + sources.push_back(path); + g_free(path); + } + + // On OS X: + if ( g_file_test("/Library/ColorSync/Profiles", G_FILE_TEST_EXISTS) && g_file_test("/Library/ColorSync/Profiles", G_FILE_TEST_IS_DIR) ) { + sources.push_back("/Library/ColorSync/Profiles"); + + gchar* path = g_build_filename(g_get_home_dir(), "Library", "ColorSync", "Profiles", NULL); + if ( g_file_test(path, G_FILE_TEST_EXISTS) && g_file_test(path, G_FILE_TEST_IS_DIR) ) { + sources.push_back(path); + } + g_free(path); } + +// #ifdef WIN32 +// wchar_t pathBuf[MAX_PATH + 1]; +// pathBuf[0] = 0; +// DWORD pathSize = sizeof(pathBuf); +// g_assert(sizeof(wchar_t) == sizeof(gunichar2)); +// if ( GetColorDirectoryW( NULL, &pathBuf, &pathSize ) ) { +// gchar * utf8Path = g_utf16_to_utf8( (gunichar2*)(&pathBuf[0]), -1, NULL, NULL, NULL ); +// if ( !g_utf8_validate(utf8Path, -1, NULL) ) { +// g_warning( "GetColorDirectoryW() resulted in invalid UTF-8" ); +// } else { +// sources.pushback(utf8Path); +// } +// g_free( utf8Path ); +// } +// #endif // WIN32 + return sources; } |
