mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Revert "ELinks doesn't change current directory, so get_cwd and set_cwd are useless"
This reverts f53cbc756f
commit.
This commit is contained in:
parent
f53cbc756f
commit
a35307f85a
@ -594,6 +594,7 @@ create_download_file_do(struct terminal *term, unsigned char *file, void *data,
|
|||||||
int resume)
|
int resume)
|
||||||
{
|
{
|
||||||
struct cdf_hop *cdf_hop = data;
|
struct cdf_hop *cdf_hop = data;
|
||||||
|
unsigned char *wd;
|
||||||
int h = -1;
|
int h = -1;
|
||||||
int saved_errno;
|
int saved_errno;
|
||||||
#ifdef NO_FILE_SECURITY
|
#ifdef NO_FILE_SECURITY
|
||||||
@ -604,6 +605,9 @@ create_download_file_do(struct terminal *term, unsigned char *file, void *data,
|
|||||||
|
|
||||||
if (!file) goto finish;
|
if (!file) goto finish;
|
||||||
|
|
||||||
|
wd = get_cwd();
|
||||||
|
set_cwd(term->cwd);
|
||||||
|
|
||||||
/* Create parent directories if needed. */
|
/* Create parent directories if needed. */
|
||||||
mkalldirs(file);
|
mkalldirs(file);
|
||||||
|
|
||||||
@ -615,6 +619,11 @@ create_download_file_do(struct terminal *term, unsigned char *file, void *data,
|
|||||||
sf ? 0600 : 0666);
|
sf ? 0600 : 0666);
|
||||||
saved_errno = errno; /* Saved in case of ... --Zas */
|
saved_errno = errno; /* Saved in case of ... --Zas */
|
||||||
|
|
||||||
|
if (wd) {
|
||||||
|
set_cwd(wd);
|
||||||
|
mem_free(wd);
|
||||||
|
}
|
||||||
|
|
||||||
if (h == -1) {
|
if (h == -1) {
|
||||||
info_box(term, MSGBOX_FREE_TEXT,
|
info_box(term, MSGBOX_FREE_TEXT,
|
||||||
N_("Download error"), ALIGN_CENTER,
|
N_("Download error"), ALIGN_CENTER,
|
||||||
@ -658,6 +667,7 @@ create_download_file(struct terminal *term, unsigned char *fi,
|
|||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct cdf_hop *cdf_hop = mem_calloc(1, sizeof(*cdf_hop));
|
struct cdf_hop *cdf_hop = mem_calloc(1, sizeof(*cdf_hop));
|
||||||
|
unsigned char *wd;
|
||||||
|
|
||||||
if (!cdf_hop) {
|
if (!cdf_hop) {
|
||||||
callback(term, -1, data, 0);
|
callback(term, -1, data, 0);
|
||||||
@ -669,8 +679,17 @@ create_download_file(struct terminal *term, unsigned char *fi,
|
|||||||
cdf_hop->callback = callback;
|
cdf_hop->callback = callback;
|
||||||
cdf_hop->data = data;
|
cdf_hop->data = data;
|
||||||
|
|
||||||
|
/* FIXME: The wd bussiness is probably useless here? --pasky */
|
||||||
|
wd = get_cwd();
|
||||||
|
set_cwd(term->cwd);
|
||||||
|
|
||||||
/* Also the tilde will be expanded here. */
|
/* Also the tilde will be expanded here. */
|
||||||
lookup_unique_name(term, fi, resume, create_download_file_do, cdf_hop);
|
lookup_unique_name(term, fi, resume, create_download_file_do, cdf_hop);
|
||||||
|
|
||||||
|
if (wd) {
|
||||||
|
set_cwd(wd);
|
||||||
|
mem_free(wd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user