mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Print paths to internal files in verbose mode
When run with -v option, this prints local file names like the path to the local git repository and the hash file. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3f900885df
commit
a241393e7b
9 changed files with 63 additions and 9 deletions
34
qthelper.cpp
34
qthelper.cpp
|
|
@ -1078,9 +1078,19 @@ extern "C" char * hashstring(char * filename)
|
|||
return hashOf[QString(filename)].toHex().data();
|
||||
}
|
||||
|
||||
const QString hashfile_name()
|
||||
{
|
||||
return QString(system_default_directory()).append("/hashes");
|
||||
}
|
||||
|
||||
extern "C" char *hashfile_name_string()
|
||||
{
|
||||
return strdup(hashfile_name().toUtf8().data());
|
||||
}
|
||||
|
||||
void read_hashes()
|
||||
{
|
||||
QFile hashfile(QString(system_default_directory()).append("/hashes"));
|
||||
QFile hashfile(hashfile_name());
|
||||
if (hashfile.open(QIODevice::ReadOnly)) {
|
||||
QDataStream stream(&hashfile);
|
||||
stream >> localFilenameOf;
|
||||
|
|
@ -1091,7 +1101,7 @@ void read_hashes()
|
|||
|
||||
void write_hashes()
|
||||
{
|
||||
QSaveFile hashfile(QString(system_default_directory()).append("/hashes"));
|
||||
QSaveFile hashfile(hashfile_name());
|
||||
if (hashfile.open(QIODevice::WriteOnly)) {
|
||||
QDataStream stream(&hashfile);
|
||||
stream << localFilenameOf;
|
||||
|
|
@ -1210,13 +1220,22 @@ extern "C" bool picture_exists(struct picture *picture)
|
|||
return same_string(hash.toHex().data(), picture->hash);
|
||||
}
|
||||
|
||||
const QString picturedir()
|
||||
{
|
||||
return QString(system_default_directory()).append("/picturedata/");
|
||||
}
|
||||
|
||||
extern "C" char *picturedir_string()
|
||||
{
|
||||
return strdup(picturedir().toUtf8().data());
|
||||
}
|
||||
|
||||
/* when we get a picture from git storage (local or remote) and can't find the picture
|
||||
* based on its hash, we create a local copy with the hash as filename and the appropriate
|
||||
* suffix */
|
||||
extern "C" void savePictureLocal(struct picture *picture, const char *data, int len)
|
||||
{
|
||||
QString dirname(system_default_directory());
|
||||
dirname += "/picturedata/";
|
||||
QString dirname = picturedir();
|
||||
QDir localPictureDir(dirname);
|
||||
localPictureDir.mkpath(dirname);
|
||||
QString suffix(picture->filename);
|
||||
|
|
@ -1386,6 +1405,13 @@ int getCloudURL(QString &filename)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern "C" char *cloud_url()
|
||||
{
|
||||
QString filename;
|
||||
getCloudURL(filename);
|
||||
return strdup(filename.toUtf8().data());
|
||||
}
|
||||
|
||||
void loadPreferences()
|
||||
{
|
||||
QSettings s;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue