예제 #1
0
파일: filesystem.hpp 프로젝트: spolitov/lib
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.cpp 프로젝트: sfpgmr/sfmf2
 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)));
 }