コード例 #1
0
ファイル: main.cpp プロジェクト: angelstudio/sview
    /**
     * Copy OCCT resource file.
     */
    ST_LOCAL bool copyResource(const StHandle<StResourceManager>& theResMgr,
                               const StString& theResFolder,
                               const StString& theDestFolder,
                               const StString& theFileName) {
        StString aFileResPath = theResFolder + SYS_FS_SPLITTER + theFileName;
        StHandle<StResource> aRes = theResMgr->getResource(aFileResPath);
        if( aRes.isNull()
        || !aRes->read()) {
            ST_ERROR_LOG(StString("Can not read resource file ") + aFileResPath);
            return false;
        }

        StRawFile aFileOut;
        StString  aFileOutPath = theDestFolder + SYS_FS_SPLITTER + theFileName;
        if(!aFileOut.openFile(StRawFile::WRITE, aFileOutPath)) {
            ST_ERROR_LOG(StString("Can not create resource file ") + aFileOutPath);
            return false;
        }
        if(!aFileOut.write((const char* )aRes->getData(), aRes->getSize()) != aRes->getSize()) {
            ST_ERROR_LOG(StString("Can not write resource file ") + aFileOutPath);
            return false;
        }
        return true;
    }