mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 02:26:41 +00:00 
			
		
		
		
	add project file to content file list when running OpenMW from OpenCS
This commit is contained in:
		
							parent
							
								
									10fa205ced
								
							
						
					
					
						commit
						081588f484
					
				
					 5 changed files with 26 additions and 8 deletions
				
			
		| 
						 | 
					@ -2211,7 +2211,8 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
 | 
				
			||||||
  mTools (*this), mResDir(resDir),
 | 
					  mTools (*this), mResDir(resDir),
 | 
				
			||||||
  mProjectPath ((configuration.getUserDataPath() / "projects") /
 | 
					  mProjectPath ((configuration.getUserDataPath() / "projects") /
 | 
				
			||||||
  (savePath.filename().string() + ".project")),
 | 
					  (savePath.filename().string() + ".project")),
 | 
				
			||||||
  mSaving (*this, mProjectPath, encoding)
 | 
					  mSaving (*this, mProjectPath, encoding),
 | 
				
			||||||
 | 
					  mRunner (mProjectPath)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (mContentFiles.empty())
 | 
					    if (mContentFiles.empty())
 | 
				
			||||||
        throw std::runtime_error ("Empty content file sequence");
 | 
					        throw std::runtime_error ("Empty content file sequence");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "operation.hpp"
 | 
					#include "operation.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CSMDoc::Runner::Runner() : mRunning (false), mStartup (0)
 | 
					CSMDoc::Runner::Runner (const boost::filesystem::path& projectPath)
 | 
				
			||||||
 | 
					: mRunning (false), mStartup (0), mProjectPath (projectPath)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    connect (&mProcess, SIGNAL (finished (int, QProcess::ExitStatus)),
 | 
					    connect (&mProcess, SIGNAL (finished (int, QProcess::ExitStatus)),
 | 
				
			||||||
        this, SLOT (finished (int, QProcess::ExitStatus)));
 | 
					        this, SLOT (finished (int, QProcess::ExitStatus)));
 | 
				
			||||||
| 
						 | 
					@ -73,7 +74,10 @@ void CSMDoc::Runner::start (bool delayed)
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
            arguments << "--new-game=1";
 | 
					            arguments << "--new-game=1";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        arguments << ("--script-run="+mStartup->fileName());
 | 
					        arguments << ("--script-run="+mStartup->fileName());;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        arguments <<
 | 
				
			||||||
 | 
					            QString::fromUtf8 (("--data="+mProjectPath.parent_path().string()).c_str());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (std::vector<std::string>::const_iterator iter (mContentFiles.begin());
 | 
					        for (std::vector<std::string>::const_iterator iter (mContentFiles.begin());
 | 
				
			||||||
            iter!=mContentFiles.end(); ++iter)
 | 
					            iter!=mContentFiles.end(); ++iter)
 | 
				
			||||||
| 
						 | 
					@ -81,6 +85,9 @@ void CSMDoc::Runner::start (bool delayed)
 | 
				
			||||||
            arguments << QString::fromUtf8 (("--content="+*iter).c_str());
 | 
					            arguments << QString::fromUtf8 (("--content="+*iter).c_str());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        arguments
 | 
				
			||||||
 | 
					            << QString::fromUtf8 (("--content="+mProjectPath.filename().string()).c_str());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        mProcess.start (path, arguments);
 | 
					        mProcess.start (path, arguments);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,8 @@
 | 
				
			||||||
#include <vector>
 | 
					#include <vector>
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <boost/filesystem/path.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QObject>
 | 
					#include <QObject>
 | 
				
			||||||
#include <QProcess>
 | 
					#include <QProcess>
 | 
				
			||||||
#include <QTextDocument>
 | 
					#include <QTextDocument>
 | 
				
			||||||
| 
						 | 
					@ -25,10 +27,11 @@ namespace CSMDoc
 | 
				
			||||||
            std::string mStartupInstruction;
 | 
					            std::string mStartupInstruction;
 | 
				
			||||||
            QTemporaryFile *mStartup;
 | 
					            QTemporaryFile *mStartup;
 | 
				
			||||||
            QTextDocument mLog;
 | 
					            QTextDocument mLog;
 | 
				
			||||||
 | 
					            boost::filesystem::path mProjectPath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public:
 | 
					        public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Runner();
 | 
					            Runner (const boost::filesystem::path& projectPath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ~Runner();
 | 
					            ~Runner();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -81,7 +81,13 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
 | 
				
			||||||
                mMagicEffects.load (esm);
 | 
					                mMagicEffects.load (esm);
 | 
				
			||||||
            } else if (n.val == ESM::REC_SKIL) {
 | 
					            } else if (n.val == ESM::REC_SKIL) {
 | 
				
			||||||
                mSkills.load (esm);
 | 
					                mSkills.load (esm);
 | 
				
			||||||
            } else {
 | 
					            }
 | 
				
			||||||
 | 
					            else if (n.val==ESM::REC_FILT || ESM::REC_DBGP)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                // ignore project file only records
 | 
				
			||||||
 | 
					                esm.skipRecord();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else {
 | 
				
			||||||
                std::stringstream error;
 | 
					                std::stringstream error;
 | 
				
			||||||
                error << "Unknown record: " << n.toString();
 | 
					                error << "Unknown record: " << n.toString();
 | 
				
			||||||
                throw std::runtime_error(error.str());
 | 
					                throw std::runtime_error(error.str());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -174,8 +174,9 @@ namespace MWWorld
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gameContentLoader.addLoader(".esm", &esmLoader);
 | 
					        gameContentLoader.addLoader(".esm", &esmLoader);
 | 
				
			||||||
        gameContentLoader.addLoader(".esp", &esmLoader);
 | 
					        gameContentLoader.addLoader(".esp", &esmLoader);
 | 
				
			||||||
        gameContentLoader.addLoader(".omwgame", &omwLoader);
 | 
					        gameContentLoader.addLoader(".omwgame", &esmLoader);
 | 
				
			||||||
        gameContentLoader.addLoader(".omwaddon", &omwLoader);
 | 
					        gameContentLoader.addLoader(".omwaddon", &esmLoader);
 | 
				
			||||||
 | 
					        gameContentLoader.addLoader(".project", &esmLoader);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        loadContentFiles(fileCollections, contentFiles, gameContentLoader);
 | 
					        loadContentFiles(fileCollections, contentFiles, gameContentLoader);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue