Exemplo n.º 1
0
bool copyDirFiles(const QString &SourceDir,const QString &DestDir,bool coverFileIfExist)
{
    qDebug() << Q_FUNC_INFO;
    QDir srcDir(SourceDir);
    QDir dstDir(DestDir);
    if(!dstDir.exists())
        if(dstDir.mkdir(dstDir.absolutePath())) return false;
    QFileInfoList fileInfoList = srcDir.entryInfoList();
    foreach(QFileInfo fileInfo,fileInfoList)
    {
        if(fileInfo.fileName() == "." || fileInfo.fileName() == "..")
            continue;
        if(fileInfo.isDir())
        {
            if(!copyDirFiles(fileInfo.filePath(),dstDir.filePath(fileInfo.fileName()),coverFileIfExist))
                return false;
        }
        else
        {
            if(coverFileIfExist && dstDir.exists(fileInfo.fileName()))
                    dstDir.remove(fileInfo.fileName());
            if(!QFile::copy(fileInfo.filePath(),dstDir.filePath(fileInfo.fileName())))
                return false;
        }
    }
    return true;
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    qDebug() << Q_FUNC_INFO;

    copyDirFiles(":/gif/","./image/",true);
//    copyDirFiles(":/bmp/","./image/bmp/",true);

    QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf8"));
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf8"));

    Frame frame(argc,argv);
    
    main_entry_gui(argc, argv);
    return a.exec();
}
Exemplo n.º 3
0
void copySysLinux(const char* projName)
{
#ifdef _DEBUG
	const char * appName = "MaratisPlayerDebug";
#else
	const char * appName = "MaratisPlayer";
#endif

	MEngine* engine = MEngine::getInstance();
	MSystemContext* system = engine->getSystemContext();

	char filename[256];
	getLocalFilename(filename, system->getWorkingDirectory(), projName);

	if(char* ext = strstr(filename, ".mproj"))
	{
		*ext = 0;

		MProject proj;
		if(proj.loadXML(projName))
		{
			char destName[256];
			getGlobalFilename(destName, getPubDir(), filename);

			char level[256];
			getLocalFilename(level, system->getWorkingDirectory(), proj.startLevel.c_str());

			strcpy(ext, ".mproj");
			embedProject(appName, destName, filename, level, proj.renderer.c_str());
			chmod(destName, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);

			// find all dynamic libraries
			copyDirFiles(".", getPubDir(), ".so");
		}
	}
}
Exemplo n.º 4
0
void copySysWindows(const char* projName)
{
#ifdef _DEBUG
	const char * appName = "MaratisPlayerDebug.exe";
#else
	const char * appName = "MaratisPlayer.exe";
#endif

	MEngine* engine = MEngine::getInstance();
	MSystemContext* system = engine->getSystemContext();

	char filename[256];
	getLocalFilename(filename, system->getWorkingDirectory(), projName);

	if(char* ext = strstr(filename, ".mproj"))
	{
		MProject proj;
		if(proj.loadXML(projName))
		{
			strcpy(ext, ".exe");
			char destName[256];
			getGlobalFilename(destName, getPubDir(), filename);

			char level[256];
			getLocalFilename(level, system->getWorkingDirectory(), proj.startLevel.c_str());

			// we need the project "filename" to still be a .mproj for MaratisPlayer to behave
			// correctly
			strcpy(ext, ".mproj");
			embedProject(appName, destName, filename, level, proj.renderer.c_str());

			// find all dynamic libraries
			copyDirFiles(".", getPubDir(), ".dll");
		}
	}
}