Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,6 @@ if (NOT OWNCLOUD_ICONS)
endif()
MESSAGE(STATUS "OWNCLOUD_ICONS: ${APPLICATION_ICON_NAME}: ${OWNCLOUD_ICONS}")

set(EXCLUDE_FILE_NAME "sync-exclude.lst")

if(APPLE)
list(APPEND OWNCLOUD_BUNDLED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${EXCLUDE_FILE_NAME}")
else()
configure_file("${EXCLUDE_FILE_NAME}" "bin/${EXCLUDE_FILE_NAME}" COPYONLY)
if(WIN32)
install(FILES "${EXCLUDE_FILE_NAME}" DESTINATION bin)
else()
install(FILES "${EXCLUDE_FILE_NAME}" DESTINATION ${KDE_INSTALL_SYSCONFDIR}/${APPLICATION_SHORTNAME})
endif()
endif()

add_subdirectory(src)
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/admin)
add_subdirectory(admin)
Expand Down
6 changes: 1 addition & 5 deletions src/libsync/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ INSTALL(
)

add_library(libsync SHARED ${libsync_SRCS}
libsync.qrc
creds/credentialssupport.h)
set_target_properties(libsync PROPERTIES EXPORT_NAME SyncCore)

Expand Down Expand Up @@ -106,11 +107,6 @@ ecm_add_qml_module(libsync

ecm_finalize_qml_module(libsync DESTINATION ${KDE_INSTALL_QMLDIR})

set_source_files_properties(configfile.cpp
PROPERTIES
COMPILE_DEFINITIONS EXCLUDE_FILE_NAME="${EXCLUDE_FILE_NAME}"
)

target_link_libraries(libsync PUBLIC $<BUILD_INTERFACE:OpenAPI::LibreGraphAPI>)
add_subdirectory(graphapi)

Expand Down
33 changes: 2 additions & 31 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ const QString issuesWidgetFilterC()

QString excludeFileNameC()
{
static_assert(!std::string_view(EXCLUDE_FILE_NAME).empty());
return QStringLiteral(EXCLUDE_FILE_NAME);
return QStringLiteral("sync-exclude.lst");
}

} // anonymous namespace
Expand Down Expand Up @@ -253,35 +252,7 @@ QString ConfigFile::excludeFile(Scope scope) const

QString ConfigFile::excludeFileFromSystem()
{
QFileInfo fi;
#ifdef Q_OS_WIN
fi.setFile(QCoreApplication::applicationDirPath(), excludeFileNameC());
#endif
#ifdef Q_OS_UNIX
fi.setFile(QStringLiteral(SYSCONFDIR "/%1").arg(Theme::instance()->appName()), excludeFileNameC());
if (!fi.exists()) {
// Prefer to return the preferred path! Only use the fallback location
// if the other path does not exist and the fallback is valid.
QFileInfo nextToBinary(QCoreApplication::applicationDirPath(), excludeFileNameC());
if (nextToBinary.exists()) {
fi = nextToBinary;
} else {
// use from install tree (e.g., AppImage, local dev installation)
// for example, if the binary is in .../AppDir/usr/bin/<binary>, the exclude file will be in .../AppDir/usr/etc/<appname>/
QFileInfo relativeToBinary(
QStringLiteral("%1/../etc/%2/%3").arg(QCoreApplication::applicationDirPath(), Theme::instance()->appName(), excludeFileNameC()));
if (relativeToBinary.exists()) {
fi = relativeToBinary;
}
}
}
#endif
#ifdef Q_OS_MAC
// exec path is inside the bundle
fi.setFile(QCoreApplication::applicationDirPath(), QLatin1String("../Resources/") + excludeFileNameC());
#endif

return fi.absoluteFilePath();
return ":/libsync/sync-exclude.lst";
}

QString ConfigFile::backup() const
Expand Down
5 changes: 5 additions & 0 deletions src/libsync/libsync.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/libsync">
<file>sync-exclude.lst</file>
</qresource>
</RCC>
File renamed without changes.
2 changes: 1 addition & 1 deletion test/testexcludedfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using namespace OCC;

namespace {
const QString excludeListFileC = QStringLiteral(SOURCEDIR "/sync-exclude.lst");
const QString excludeListFileC = QStringLiteral(":/libsync/sync-exclude.lst");
}
// The tests were converted from the old CMocka framework, that's why there is a global
static QScopedPointer<ExcludedFiles> excludedFiles;
Expand Down
Loading