Search
lxdream.org :: lxdream :: r613:c2dd87f947b2
lxdream 0.9.1
released Jun 29
Download Now
changeset613:c2dd87f947b2
parent612:410b48e63d53
child614:a2d239d4438a
authornkeynes
dateMon Jan 28 02:37:09 2008 +0000 (11 years ago)
Add general purpose relative filename helper
src/gdrom/gdrom.c
src/gdrom/gdrom.h
1.1 --- a/src/gdrom/gdrom.c Sat Jan 26 03:45:49 2008 +0000
1.2 +++ b/src/gdrom/gdrom.c Mon Jan 28 02:37:09 2008 +0000
1.3 @@ -116,3 +116,11 @@
1.4 {
1.5 return gdrom_disc;
1.6 }
1.7 +
1.8 +gchar *gdrom_get_relative_filename( const gchar *base_name, const gchar *rel_name )
1.9 +{
1.10 + gchar *dirname = g_path_get_dirname(base_name);
1.11 + gchar *pathname = g_strdup_printf( "%s%c%s", dirname, G_DIR_SEPARATOR, rel_name );
1.12 + g_free(dirname);
1.13 + return pathname;
1.14 +}
2.1 --- a/src/gdrom/gdrom.h Sat Jan 26 03:45:49 2008 +0000
2.2 +++ b/src/gdrom/gdrom.h Mon Jan 28 02:37:09 2008 +0000
2.3 @@ -224,4 +224,11 @@
2.4 uint32_t gdrom_read_sectors( uint32_t sector, uint32_t sector_count,
2.5 int mode, unsigned char *buf, uint32_t *length );
2.6
2.7 +/**
2.8 + * Given a base filename (eg for a .cue file), generate the path for the given
2.9 + * find_name relative to the original file.
2.10 + * @return a newly allocated string.
2.11 + */
2.12 +gchar *gdrom_get_relative_filename( const gchar *base_name, const gchar *find_name );
2.13 +
2.14 #endif
.