fix: skip '.' and '..' entries while copying, append home dir to destination paths
This commit is contained in:
parent
3bc3c7b8db
commit
d7e347175f
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-05-02 22:56+0300\n"
|
||||
"POT-Creation-Date: 2024-05-02 23:10+0300\n"
|
||||
"PO-Revision-Date: 2024-05-01 13:34+0300\n"
|
||||
"Last-Translator: <ngn@ngn.tf>\n"
|
||||
"Language-Team: Turkish <gnome-turk@gnome.org>\n"
|
||||
@ -17,48 +17,48 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: src/config.c:23
|
||||
#: src/config.c:24
|
||||
msgid "Configuration does not have a name field"
|
||||
msgstr ""
|
||||
|
||||
#: src/config.c:28
|
||||
#: src/config.c:29
|
||||
msgid "Configuration does not have an author field"
|
||||
msgstr ""
|
||||
|
||||
#: src/config.c:33
|
||||
#: src/config.c:34
|
||||
msgid "Configuration does not have any targets"
|
||||
msgstr ""
|
||||
|
||||
#: src/config.c:91
|
||||
#: src/config.c:92
|
||||
msgid "Configuration contains multiple targets with the same name"
|
||||
msgstr ""
|
||||
|
||||
#: src/config.c:113
|
||||
#: src/config.c:116
|
||||
#, c-format
|
||||
msgid "Key %s is unknown"
|
||||
msgstr ""
|
||||
|
||||
#: src/config.c:143
|
||||
#: src/config.c:146
|
||||
msgid "Configuration file not found"
|
||||
msgstr ""
|
||||
|
||||
#: src/config.c:158
|
||||
#: src/config.c:161
|
||||
msgid "Failed to parse configuration file"
|
||||
msgstr ""
|
||||
|
||||
#: src/config.c:174
|
||||
#: src/config.c:177
|
||||
msgid "Configuration details:\n"
|
||||
msgstr ""
|
||||
|
||||
#: src/config.c:175
|
||||
#: src/config.c:178
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: src/config.c:176
|
||||
#: src/config.c:179
|
||||
msgid "Author"
|
||||
msgstr ""
|
||||
|
||||
#: src/config.c:178
|
||||
#: src/config.c:181
|
||||
msgid "Keywords"
|
||||
msgstr ""
|
||||
|
||||
@ -86,15 +86,10 @@ msgstr ""
|
||||
msgid "Copying all the targets"
|
||||
msgstr ""
|
||||
|
||||
#: src/gen.c:47
|
||||
#: src/gen.c:48
|
||||
msgid "Failed to copy the target:"
|
||||
msgstr ""
|
||||
|
||||
#: src/gen.c:53
|
||||
#, c-format
|
||||
msgid "%s: copy success"
|
||||
msgstr ""
|
||||
|
||||
#: src/log.c:145
|
||||
msgid "y"
|
||||
msgstr ""
|
||||
@ -221,7 +216,7 @@ msgstr ""
|
||||
msgid "Failed to open the directory: %s"
|
||||
msgstr ""
|
||||
|
||||
#: src/target.c:76
|
||||
#: src/target.c:79
|
||||
#, c-format
|
||||
msgid "Source directory \"%s\" does not exist"
|
||||
msgstr ""
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "paths.h"
|
||||
#include "config.h"
|
||||
#include "error.h"
|
||||
#include "intl.h"
|
||||
@ -99,7 +100,9 @@ int config_handler(void *data, const char *section, const char *key, const char
|
||||
config->t_last->desc = strdup(value);
|
||||
return 1;
|
||||
} else if (MATCHKEY("dst")) {
|
||||
config->t_last->dst = strdup(value);
|
||||
int len = strlen(value)+strlen(mc_root)+2;
|
||||
config->t_last->dst = malloc(len);
|
||||
join(config->t_last->dst, mc_root, value);
|
||||
return 1;
|
||||
} else if (MATCHKEY("src")) {
|
||||
config->t_last->src = strdup(value);
|
||||
|
@ -44,13 +44,12 @@ bool gen_cmd() {
|
||||
|
||||
while (cur && ++counter > 0) {
|
||||
if(!target_copy(cur, true)){
|
||||
bar_free();
|
||||
error(_("Failed to copy the target:"));
|
||||
details(errch);
|
||||
bar_free();
|
||||
goto END;
|
||||
}
|
||||
|
||||
success(_("%s: copy success"));
|
||||
bar(counter, cfg.t_len);
|
||||
cur = cur->next;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
char *mc_lock_path;
|
||||
char *mc_tmp_path;
|
||||
char *mc_root;
|
||||
char *mc_home;
|
||||
char *mc_dir;
|
||||
|
||||
char *append_root(char *pth) {
|
||||
|
@ -28,7 +28,7 @@ bool target_is_valid(target_t *t) {
|
||||
}
|
||||
|
||||
bool target_copy_dir(char *src, char *dst) {
|
||||
if (!mksubdirsp(dst, 755))
|
||||
if (!mksubdirsp(dst, 0755))
|
||||
return false;
|
||||
|
||||
DIR *dir = opendir(src);
|
||||
@ -44,6 +44,9 @@ bool target_copy_dir(char *src, char *dst) {
|
||||
size_t dst_len = strlen(dst);
|
||||
|
||||
while ((ent = readdir(dir)) != NULL) {
|
||||
if(eq(ent->d_name, ".") || eq(ent->d_name, ".."))
|
||||
continue;
|
||||
|
||||
size_t len = strlen(ent->d_name);
|
||||
char src_fp[src_len + len + 2], dst_fp[dst_len + len + 2];
|
||||
|
||||
@ -72,7 +75,7 @@ bool target_copy(target_t *t, bool fromdst) {
|
||||
dst = t->src;
|
||||
}
|
||||
|
||||
if (!exists(t->src)) {
|
||||
if (!exists(src)) {
|
||||
error_set(_("Source directory \"%s\" does not exist"), src);
|
||||
errno = TargetSrcFail;
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user