mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Use get_expanded_path() in cmd_senfile()
This commit is contained in:
parent
a2291b36c4
commit
55f09b6152
@ -4854,18 +4854,12 @@ gboolean
|
|||||||
cmd_sendfile(ProfWin* window, const char* const command, gchar** args)
|
cmd_sendfile(ProfWin* window, const char* const command, gchar** args)
|
||||||
{
|
{
|
||||||
jabber_conn_status_t conn_status = connection_get_status();
|
jabber_conn_status_t conn_status = connection_get_status();
|
||||||
char* filename = args[0];
|
gchar* filename;
|
||||||
char* alt_scheme = NULL;
|
char* alt_scheme = NULL;
|
||||||
char* alt_fragment = NULL;
|
char* alt_fragment = NULL;
|
||||||
|
|
||||||
// expand ~ to $HOME
|
// expand ~ to $HOME
|
||||||
if (filename[0] == '~' && filename[1] == '/') {
|
filename = get_expanded_path(args[0]);
|
||||||
if (asprintf(&filename, "%s/%s", getenv("HOME"), filename + 2) == -1) {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
filename = strdup(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (access(filename, R_OK) != 0) {
|
if (access(filename, R_OK) != 0) {
|
||||||
cons_show_error("Uploading '%s' failed: File not found!", filename);
|
cons_show_error("Uploading '%s' failed: File not found!", filename);
|
||||||
|
@ -108,5 +108,6 @@ gboolean call_external(gchar** argv, gchar*** const output_ptr, gchar*** const e
|
|||||||
gchar** format_call_external_argv(const char* template, const char* url, const char* filename);
|
gchar** format_call_external_argv(const char* template, const char* url, const char* filename);
|
||||||
|
|
||||||
gchar* unique_filename_from_url(const char* url, const char* path);
|
gchar* unique_filename_from_url(const char* url, const char* path);
|
||||||
|
gchar* get_expanded_path(const char *path);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user