mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-14 12:37:23 +00:00
WIP clean Library a bit
This commit is contained in:
@@ -8,13 +8,19 @@
|
|||||||
#include <FileSystem.h>
|
#include <FileSystem.h>
|
||||||
|
|
||||||
|
|
||||||
void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32,
|
void Library::getApplicableFiles(
|
||||||
QStringList& native64, const QString &overridePath) const
|
OpSys system,
|
||||||
|
QStringList& jar,
|
||||||
|
QStringList& native,
|
||||||
|
QStringList& native32,
|
||||||
|
QStringList& native64,
|
||||||
|
const QString &overridePath
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
bool local = isInstanceLocal();
|
bool local = isInstanceLocal();
|
||||||
auto actualPath = [&](QString relPath)
|
auto actualPath = [&](QString relPath)
|
||||||
{
|
{
|
||||||
QFileInfo out(FS::PathCombine(storagePrefix(), relPath));
|
QFileInfo out(FS::PathCombine("libraries", relPath));
|
||||||
if(local && !overridePath.isEmpty())
|
if(local && !overridePath.isEmpty())
|
||||||
{
|
{
|
||||||
QString fileName = out.fileName();
|
QString fileName = out.fileName();
|
||||||
@@ -98,7 +104,9 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(
|
|||||||
entry->setStale(true);
|
entry->setStale(true);
|
||||||
}
|
}
|
||||||
if (!entry->isStale())
|
if (!entry->isStale())
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
Net::Download::Options options;
|
Net::Download::Options options;
|
||||||
if(stale)
|
if(stale)
|
||||||
{
|
{
|
||||||
@@ -269,25 +277,6 @@ bool Library::isForge() const
|
|||||||
return m_hint == "forge-pack-xz";
|
return m_hint == "forge-pack-xz";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Library::setStoragePrefix(QString prefix)
|
|
||||||
{
|
|
||||||
m_storagePrefix = prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Library::defaultStoragePrefix()
|
|
||||||
{
|
|
||||||
return "libraries/";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Library::storagePrefix() const
|
|
||||||
{
|
|
||||||
if(m_storagePrefix.isEmpty())
|
|
||||||
{
|
|
||||||
return defaultStoragePrefix();
|
|
||||||
}
|
|
||||||
return m_storagePrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Library::filename(OpSys system) const
|
QString Library::filename(OpSys system) const
|
||||||
{
|
{
|
||||||
if(!m_filename.isEmpty())
|
if(!m_filename.isEmpty())
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public:
|
|||||||
newlib->m_extractExcludes = base->m_extractExcludes;
|
newlib->m_extractExcludes = base->m_extractExcludes;
|
||||||
newlib->m_nativeClassifiers = base->m_nativeClassifiers;
|
newlib->m_nativeClassifiers = base->m_nativeClassifiers;
|
||||||
newlib->m_rules = base->m_rules;
|
newlib->m_rules = base->m_rules;
|
||||||
newlib->m_storagePrefix = base->m_storagePrefix;
|
|
||||||
newlib->m_mojangDownloads = base->m_mojangDownloads;
|
newlib->m_mojangDownloads = base->m_mojangDownloads;
|
||||||
newlib->m_filename = base->m_filename;
|
newlib->m_filename = base->m_filename;
|
||||||
newlib->presenceOnly = base->presenceOnly;
|
newlib->presenceOnly = base->presenceOnly;
|
||||||
@@ -95,8 +94,6 @@ public: /* methods */
|
|||||||
return m_nativeClassifiers.size() != 0;
|
return m_nativeClassifiers.size() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setStoragePrefix(QString prefix = QString());
|
|
||||||
|
|
||||||
/// Set the url base for downloads
|
/// Set the url base for downloads
|
||||||
void setRepositoryURL(const QString &base_url)
|
void setRepositoryURL(const QString &base_url)
|
||||||
{
|
{
|
||||||
@@ -169,11 +166,6 @@ public: /* methods */
|
|||||||
QStringList & failedLocalFiles, const QString & overridePath) const;
|
QStringList & failedLocalFiles, const QString & overridePath) const;
|
||||||
|
|
||||||
private: /* methods */
|
private: /* methods */
|
||||||
/// the default storage prefix used by MultiMC
|
|
||||||
static QString defaultStoragePrefix();
|
|
||||||
|
|
||||||
/// Get the prefix - root of the storage to be used
|
|
||||||
QString storagePrefix() const;
|
|
||||||
|
|
||||||
/// Get the relative file path where the library should be saved
|
/// Get the relative file path where the library should be saved
|
||||||
QString storageSuffix(OpSys system) const;
|
QString storageSuffix(OpSys system) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user