Skip to content

Commit

Permalink
fix ios demo projects bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Jan 14, 2021
1 parent 831d3fc commit f856e61
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
5 changes: 3 additions & 2 deletions app/inpututils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,13 @@ bool InputUtils::cpDir( const QString &srcPath, const QString &dstPath, bool onl
QDir parentDstDir( QFileInfo( dstPath ).path() );
if ( !parentDstDir.mkpath( dstPath ) )
{
qDebug() << "Cannot make path " << dstPath;
log( "cpDir", QString( "Cannot make path %1" ).arg( dstPath ) );
return false;
}

QDir srcDir( srcPath );
foreach ( const QFileInfo &info, srcDir.entryInfoList( QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden ) )
const QFileInfoList fileInfoList = srcDir.entryInfoList( QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden );
foreach ( const QFileInfo &info, fileInfoList )
{
QString srcItemPath = srcPath + "/" + info.fileName();
QString dstItemPath = dstPath + "/" + info.fileName();
Expand Down
8 changes: 4 additions & 4 deletions app/ios.pri
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ ios {
QMAKE_RPATHDIR += @executable_path/../Frameworks
QMAKE_INFO_PLIST = ios/Info.plist

# https://doc.qt.io/qt-5.9/platform-notes-ios.html
demoFiles.files = $$files(android/assets/qgis-data/demo-projects/*)
demoFiles.path = qgis-data/demo-projects
# demo projects
demoFiles.files = $$files(android/assets/demo-projects/*)
demoFiles.path = demo-projects
QMAKE_BUNDLE_DATA += demoFiles


# qgis resources
crsFiles.files = $$files(android/assets/qgis-data/resources/*)
crsFiles.path = qgis-data/resources
QMAKE_BUNDLE_DATA += crsFiles
Expand Down
1 change: 1 addition & 0 deletions app/localprojectsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void LocalProjectsManager::reloadProjectDir()

mProjects << info;
}
qDebug() << "LocalProjectsManager: found" << mProjects.size() << "projects";
}

LocalProjectInfo LocalProjectsManager::projectFromDirectory( const QString &projectDir ) const
Expand Down
24 changes: 15 additions & 9 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,16 @@ static void setEnvironmentQgisPrefixPath()
}


static void copy_demo_projects( const QString &projectDir )
static void copy_demo_projects( const QString &demoDir, const QString &projectDir )
{
#if defined (ANDROID) || defined (Q_OS_IOS)
InputUtils::cpDir( "assets:/demo-projects", projectDir );
#elif defined (Q_OS_WIN32)
InputUtils::cpDir( QCoreApplication::applicationDirPath() + "/demo-projects", projectDir );
#else
Q_UNUSED( projectDir );
#endif
if (!demoDir.isEmpty())
InputUtils::cpDir( demoDir, projectDir );

QFile demoFile( projectDir + "/Start here!/qgis-project.qgz" );
if ( demoFile.exists() )
qDebug() << "DEMO projects initialized";
else
InputUtils::log( QStringLiteral( "DEMO" ), QStringLiteral( "The Input has failed to initialize demo projects" ) );
}

static void init_qgis( const QString &pkgPath )
Expand Down Expand Up @@ -361,19 +362,24 @@ int main( int argc, char *argv[] )
setEnvironmentQgisPrefixPath();

QString appBundleDir;
QString demoDir;

#ifdef ANDROID
appBundleDir = dataDir + "/qgis-data";
demoDir = "assets:/demo-projects";
#endif
#ifdef Q_OS_IOS
appBundleDir = QCoreApplication::applicationDirPath() + "/qgis-data";
demoDir = QCoreApplication::applicationDirPath() + "/demo-projects";
#endif
#ifdef Q_OS_WIN32
appBundleDir = QCoreApplication::applicationDirPath() + "\\qgis-data";
//TODO win32 package demo projects
#endif

init_proj( appBundleDir );
init_qgis( appBundleDir );
copy_demo_projects( projectDir );
copy_demo_projects( demoDir, projectDir );

// Create Input classes
AndroidUtils au;
Expand Down

4 comments on commit f856e61

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signed apk: armeabi-v7a (SDK: android-19)

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signed apk: arm64-v8a (SDK: android-19)

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

win-apk: x86_64 (SDK: win-10)

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ios-1.10.210114133203 (SDK: ios-10)

Please sign in to comment.