Issue #33636 make path names toc/cue files be relative to the toc/cue when no absolute path is specified in toc/cue FILENAME statements.

This commit is contained in:
R. Bernstein
2011-12-11 10:59:36 -05:00
parent 1841da6de0
commit 29b7baa1d6
6 changed files with 16 additions and 9 deletions

View File

@@ -6,6 +6,7 @@
# include "config.h" # include "config.h"
# define __CDIO_CONFIG_H__ 1 # define __CDIO_CONFIG_H__ 1
#endif #endif
#include "cdio_private.h"
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
# include <string.h> # include <string.h>

View File

@@ -1,7 +1,6 @@
/* /*
$Id: cdio_private.h,v 1.37 2008/04/22 15:29:11 karl Exp $ Copyright (C) 2003, 2004, 2005, 2008, 2009, 2011
Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2003, 2004, 2005, 2008, 2009 Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -36,6 +35,9 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
extern const char * cdio_dirname(const char *fname);
extern const char *cdio_abspath(const char *cwd, const char *fname);
/* Opaque type */ /* Opaque type */
typedef struct _CdioDataSource CdioDataSource_t; typedef struct _CdioDataSource CdioDataSource_t;

View File

@@ -53,7 +53,7 @@ typedef struct {
int num_indices; int num_indices;
flag_t flags; /**< "[NO] COPY", "4CH", "[NO] PREMPAHSIS" */ flag_t flags; /**< "[NO] COPY", "4CH", "[NO] PREMPAHSIS" */
char *isrc; /**< IRSC Code (5.22.4) exactly 12 bytes */ char *isrc; /**< IRSC Code (5.22.4) exactly 12 bytes */
char *filename; char *filename;
CdioDataSource_t *data_source; CdioDataSource_t *data_source;
off_t offset; /**< byte offset into data_start of track off_t offset; /**< byte offset into data_start of track
beginning. In cdrdao for example, one beginning. In cdrdao for example, one

View File

@@ -369,7 +369,9 @@ parse_cuefile (_img_private_t *cd, const char *psz_cue_name)
/* FILE "<filename>" <BINARY|WAVE|other?> */ /* FILE "<filename>" <BINARY|WAVE|other?> */
} else if (0 == strcmp ("FILE", psz_keyword)) { } else if (0 == strcmp ("FILE", psz_keyword)) {
if (NULL != (psz_field = strtok (NULL, "\"\t\n\r"))) { if (NULL != (psz_field = strtok (NULL, "\"\t\n\r"))) {
if (cd) cd->tocent[i + 1].filename = strdup (psz_field); const char *dirname = cdio_dirname(psz_cue_name);
const char *filename = cdio_abspath (dirname, psz_field);
if (cd) cd->tocent[i + 1].filename = (char *) filename;
} else { } else {
goto format_error; goto format_error;
} }

View File

@@ -682,7 +682,9 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
/* Handle "<filename>" */ /* Handle "<filename>" */
if (cd) { if (cd) {
cd->tocent[i].filename = strdup (psz_field); const char *dirname = cdio_dirname(psz_cue_name);
const char *filename = cdio_abspath (dirname, psz_field);
cd->tocent[i].filename = strdup (filename);
/* To do: do something about reusing existing files. */ /* To do: do something about reusing existing files. */
if (!(cd->tocent[i].data_source = cdio_stdio_new (psz_field))) { if (!(cd->tocent[i].data_source = cdio_stdio_new (psz_field))) {
cdio_log (log_level, cdio_log (log_level,
@@ -755,7 +757,9 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
if (NULL != (psz_field = strtok (NULL, "\"\t\n\r"))) { if (NULL != (psz_field = strtok (NULL, "\"\t\n\r"))) {
/* Handle <filename> */ /* Handle <filename> */
if (cd) { if (cd) {
cd->tocent[i].filename = strdup (psz_field); const char *dirname = cdio_dirname(psz_cue_name);
const char *filename = cdio_abspath (dirname, psz_field);
cd->tocent[i].filename = (char *) filename;
/* To do: do something about reusing existing files. */ /* To do: do something about reusing existing files. */
if (!(cd->tocent[i].data_source = cdio_stdio_new (psz_field))) { if (!(cd->tocent[i].data_source = cdio_stdio_new (psz_field))) {
cdio_log (log_level, cdio_log (log_level,

View File

@@ -1,6 +1,4 @@
/* /*
$Id: image_common.h,v 1.13 2008/04/22 15:29:12 karl Exp $
Copyright (C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify