/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #include "OdaCommon.h" #include "OdString.h" #include "ADSKRegistry.h" #include "NwRegistryUtils.h" #ifndef ODA_UNIXOS #define pathChar '\\' #define oldPathChar '/' #else #define pathChar '/' #define oldPathChar '\\' #endif OdString GetRegistryADSKAssetLibraryLocation() { #if defined(ODA_WINDOWS) OdString subkey = L"SOFTWARE\\WOW6432Node\\Autodesk\\ADSKAssetLibrary\\"; TCHAR searchPath[LARGE_STRING_SIZE]; // get the version and concatenate onto subkey if (GetRegistryString(HKEY_LOCAL_MACHINE, (LPCTSTR)subkey, L"LibraryPaths", searchPath, LARGE_STRING_SIZE) != 0) { subkey += pathChar; subkey += searchPath;//it should be a year if (GetRegistryString(HKEY_LOCAL_MACHINE, (LPCTSTR)subkey, L"LibraryPaths", searchPath, LARGE_STRING_SIZE) != 0) { OdString path = searchPath; path.replace(oldPathChar, pathChar); return path.left(path.reverseFind(pathChar) + 1) + L"assetlibrary_base.fbm"; } } #endif return OdString::kEmpty; } OdString GetRegistryADSKTextureLibraryLocation() { #if defined(ODA_WINDOWS) OdString subkey = L"SOFTWARE\\WOW6432Node\\Autodesk\\ADSKTextureLibrary\\1"; TCHAR searchPath[LARGE_STRING_SIZE]; // get the version and concatenate onto subkey if (GetRegistryString(HKEY_LOCAL_MACHINE, (LPCTSTR)subkey, L"LibraryPaths", searchPath, LARGE_STRING_SIZE) != 0) return OdString(searchPath); else { subkey = L"SOFTWARE\\WOW6432Node\\Autodesk\\ADSKTextureLibraryNew\\1"; if (GetRegistryString(HKEY_LOCAL_MACHINE, (LPCTSTR)subkey, L"LibraryPaths", searchPath, LARGE_STRING_SIZE) != 0) { subkey += pathChar; subkey += searchPath;//it should be a year if (GetRegistryString(HKEY_LOCAL_MACHINE, (LPCTSTR)subkey, L"LibraryPaths", searchPath, LARGE_STRING_SIZE) != 0) return OdString(searchPath); } } #endif return OdString::kEmpty; } OdString GetRegistryADSKLocation(OdNw::RegistryADSKLocation location) { OdString pathCharStr; pathCharStr = pathChar; switch (location) { case OdNw::RegistryADSKLocation::AssetLibrary: return GetRegistryADSKAssetLibraryLocation() + pathCharStr; case OdNw::RegistryADSKLocation::TextureLibrary: return GetRegistryADSKTextureLibraryLocation() + pathCharStr; default: return OdString::kEmpty; } }