Change get_path() definition in IsoFileSource.
This commit is contained in:
parent
263770ab4f
commit
baf7f14b11
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "fsource.h"
|
#include "fsource.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -32,8 +33,6 @@ IsoFilesystem *lfs= NULL;
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
/* IsoFilesystem *fs; It seems not needed */
|
|
||||||
|
|
||||||
char *path;
|
char *path;
|
||||||
unsigned int openned :2; /* 0: not openned, 1: file, 2:dir */
|
unsigned int openned :2; /* 0: not openned, 1: file, 2:dir */
|
||||||
union
|
union
|
||||||
@ -44,11 +43,11 @@ typedef struct
|
|||||||
} _LocalFsFileSource;
|
} _LocalFsFileSource;
|
||||||
|
|
||||||
static
|
static
|
||||||
const char* lfs_get_path(IsoFileSource *src)
|
char* lfs_get_path(IsoFileSource *src)
|
||||||
{
|
{
|
||||||
_LocalFsFileSource *data;
|
_LocalFsFileSource *data;
|
||||||
data = src->data;
|
data = src->data;
|
||||||
return data->path;
|
return strdup(data->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -76,10 +76,10 @@ typedef struct IsoFileSource_Iface
|
|||||||
* belongs to.
|
* belongs to.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* the path, that belong to the IsoFileSource and should not be
|
* the path of the FileSource inside the filesystem, it should be
|
||||||
* freed by the user.
|
* freed when no more needed.
|
||||||
*/
|
*/
|
||||||
const char* (*get_path)(IsoFileSource *src);
|
char* (*get_path)(IsoFileSource *src);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the file, with the dir component of the path.
|
* Get the name of the file, with the dir component of the path.
|
||||||
@ -266,7 +266,7 @@ void iso_file_source_unref(IsoFileSource *src);
|
|||||||
* this are just helpers to invoque methods in class
|
* this are just helpers to invoque methods in class
|
||||||
*/
|
*/
|
||||||
extern inline
|
extern inline
|
||||||
const char* iso_file_source_get_path(IsoFileSource *src)
|
char* iso_file_source_get_path(IsoFileSource *src)
|
||||||
{
|
{
|
||||||
return src->class->get_path(src);
|
return src->class->get_path(src);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ char *fsrc_get_name(IsoStream *stream)
|
|||||||
{
|
{
|
||||||
FSrcStreamData *data;
|
FSrcStreamData *data;
|
||||||
data = (FSrcStreamData*)stream->data;
|
data = (FSrcStreamData*)stream->data;
|
||||||
return strdup(iso_file_source_get_path(data->src));
|
return iso_file_source_get_path(data->src);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
26
src/tree.c
26
src/tree.c
@ -460,8 +460,9 @@ int iso_add_dir_aux(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
|
|||||||
|
|
||||||
result = iso_file_source_open(dir);
|
result = iso_file_source_open(dir);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
iso_msg_debug(image->messenger, "Can't open dir %s",
|
char *path = iso_file_source_get_path(dir);
|
||||||
iso_file_source_get_path(dir));
|
iso_msg_debug(image->messenger, "Can't open dir %s", path);
|
||||||
|
free(path);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,24 +470,23 @@ int iso_add_dir_aux(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
|
|||||||
action = 1;
|
action = 1;
|
||||||
while ( (result = iso_file_source_readdir(dir, &file)) == 1) {
|
while ( (result = iso_file_source_readdir(dir, &file)) == 1) {
|
||||||
int flag;
|
int flag;
|
||||||
char *name;
|
char *name, *path;
|
||||||
IsoNode *new;
|
IsoNode *new;
|
||||||
|
|
||||||
name = iso_file_source_get_name(file);
|
name = iso_file_source_get_name(file);
|
||||||
|
path = iso_file_source_get_path(file);
|
||||||
|
|
||||||
if (check_excludes(image, iso_file_source_get_path(file))) {
|
if (check_excludes(image, path)) {
|
||||||
iso_msg_debug(image->messenger, "Skipping excluded file %s",
|
iso_msg_debug(image->messenger, "Skipping excluded file %s", path);
|
||||||
iso_file_source_get_path(file));
|
|
||||||
action = 2;
|
action = 2;
|
||||||
} else if (check_hidden(image, name)) {
|
} else if (check_hidden(image, name)) {
|
||||||
iso_msg_debug(image->messenger, "Skipping hidden file %s",
|
iso_msg_debug(image->messenger, "Skipping hidden file %s", path);
|
||||||
iso_file_source_get_path(file));
|
|
||||||
action = 2;
|
action = 2;
|
||||||
} else {
|
} else {
|
||||||
iso_msg_debug(image->messenger, "Adding file %s",
|
iso_msg_debug(image->messenger, "Adding file %s", path);
|
||||||
iso_file_source_get_path(file));
|
|
||||||
action = 1;
|
action = 1;
|
||||||
}
|
}
|
||||||
|
free(path);
|
||||||
|
|
||||||
/* find place where to insert */
|
/* find place where to insert */
|
||||||
flag = 0;
|
flag = 0;
|
||||||
@ -522,10 +522,10 @@ int iso_add_dir_aux(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
|
|||||||
/* ok, file will be added */
|
/* ok, file will be added */
|
||||||
result = builder->create_node(builder, image, file, &new);
|
result = builder->create_node(builder, image, file, &new);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
char *path = iso_file_source_get_path(file);
|
||||||
iso_msg_note(image->messenger, LIBISO_FILE_IGNORED,
|
iso_msg_note(image->messenger, LIBISO_FILE_IGNORED,
|
||||||
"Error %d when adding file %s", result,
|
"Error %d when adding file %s", result, path);
|
||||||
iso_file_source_get_path(file));
|
free(path);
|
||||||
|
|
||||||
if (image->recOpts.report) {
|
if (image->recOpts.report) {
|
||||||
action = image->recOpts.report(file, result, flag);
|
action = image->recOpts.report(file, result, flag);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user