mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-15 03:43:47 +01:00
Check for ~ in save command
This commit is contained in:
parent
325b63d49e
commit
06c9f742a9
15
zathura.c
15
zathura.c
@ -3608,7 +3608,20 @@ cmd_save(int argc, char** argv)
|
|||||||
if(argc == 0 || !Zathura.PDF.document)
|
if(argc == 0 || !Zathura.PDF.document)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
char* path = g_strdup_printf("file://%s", argv[0]);
|
gchar* file_path = NULL;
|
||||||
|
|
||||||
|
if(argv[0][0] == '~')
|
||||||
|
{
|
||||||
|
gchar* home_path = get_home_dir();
|
||||||
|
file_path = g_build_filename(home_path, argv[0] + 1, NULL);
|
||||||
|
g_free(home_path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
file_path = g_strdup(argv[0]);
|
||||||
|
|
||||||
|
char* path = g_strdup_printf("file://%s", file_path);
|
||||||
|
g_free(file_path);
|
||||||
|
|
||||||
g_static_mutex_lock(&(Zathura.Lock.pdflib_lock));
|
g_static_mutex_lock(&(Zathura.Lock.pdflib_lock));
|
||||||
poppler_document_save(Zathura.PDF.document, path, NULL);
|
poppler_document_save(Zathura.PDF.document, path, NULL);
|
||||||
g_static_mutex_unlock(&(Zathura.Lock.pdflib_lock));
|
g_static_mutex_unlock(&(Zathura.Lock.pdflib_lock));
|
||||||
|
Loading…
Reference in New Issue
Block a user