mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add helper function to return local filename of picture as C string
This way we can actually find the picture that we are showing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
97386a6f3d
commit
c9d48c9a72
3 changed files with 11 additions and 2 deletions
|
@ -881,6 +881,12 @@ void learnImages(const QDir dir, int max_recursions, bool recursed)
|
|||
QtConcurrent::blockingMap(files, hashFile);
|
||||
}
|
||||
|
||||
extern "C" const char *local_file_path(struct picture *picture)
|
||||
{
|
||||
QString localFileName = fileFromHash(picture->hash);
|
||||
return strdup(qPrintable(localFileName));
|
||||
}
|
||||
|
||||
extern "C" void picture_load_exif_data(struct picture *p)
|
||||
{
|
||||
EXIFInfo exif;
|
||||
|
|
|
@ -9,5 +9,6 @@ void subsurface_mkdir(const char *dir);
|
|||
char *get_file_name(const char *fileName);
|
||||
void copy_image_and_overwrite(const char *cfileName, const char *cnewName);
|
||||
char *hashstring(char *filename);
|
||||
const char *local_file_path(struct picture *picture);
|
||||
|
||||
#endif // QTHELPERFROMC_H
|
||||
|
|
|
@ -628,8 +628,10 @@ static int save_one_picture(git_repository *repo, struct dir *dir, struct pictur
|
|||
/* next store the actual picture; we prefix all picture names
|
||||
* with "PIC-" to make things easier on the parsing side */
|
||||
struct membuffer namebuf = { 0 };
|
||||
put_format(&namebuf, "PIC-%s", hashstring(pic->filename));
|
||||
error = blob_insert_fromdisk(repo, dir, pic->filename, mb_cstring(&namebuf));
|
||||
const char *localfn = local_file_path(pic);
|
||||
put_format(&namebuf, "PIC-%s", pic->hash);
|
||||
error = blob_insert_fromdisk(repo, dir, localfn, mb_cstring(&namebuf));
|
||||
free((void *)localfn);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue