Пример #1
0
inline std::wstring wfname(const boost::filesystem::wpath & path)
{
#if BOOST_WINDOWS
#if BOOST_FILESYSTEM_VERSION >= 3
    return path.native();
#else
    return path.external_file_string();
#endif
#else
#if BOOST_FILESYSTEM_VERSION >= 3
    return deutf8(path.native());
#else
    return deutf8(path.external_file_string());
#endif
#endif
}
void AIMPControlPlugin::ensureWorkDirectoryExists()
{
    namespace fs = boost::filesystem;

    // check Plugins directory first, use it if it's writable.
    const fs::wpath plugins_subdirectory = getPluginDirectoryPath( getAimpPluginsPath() ),
                    profile_subdirectory = getPluginDirectoryPath( getAimpProfilePath() );
    if ( isDirectoryWriteEnabled(plugins_subdirectory) ) {
        plugin_work_directory_ = plugins_subdirectory;
    } else if ( isDirectoryWriteEnabled(profile_subdirectory) ) {
        plugin_work_directory_ = profile_subdirectory;
    } else {
        plugin_work_directory_ = plugins_subdirectory; // set work directory in any case.

        using namespace StringEncoding;
        // work directory is not accessible for writing or does not exist.
        // TODO: send log to aimp internal logger.
        BOOST_LOG_SEV(logger(), error) << "Neither \""
                                       << utf16_to_system_ansi_encoding_safe( plugins_subdirectory.native() )
                                       << "\", nor \"" 
                                       << utf16_to_system_ansi_encoding_safe( profile_subdirectory.native() )
                                       << "\" are accessible for writing. Use plugins subdirectory as work directory."; 
    }
}
Пример #3
0
 icon::icon(boost::filesystem::wpath& path)
 {
   icon_.reset(
     reinterpret_cast<HICON>(
       LoadImageW(NULL,path.native().c_str(),IMAGE_ICON,0,0,LR_DEFAULTSIZE | LR_LOADFROMFILE)));
 }