Revision: 57
Author: sucknblow
Date: 2006-06-19 19:07:31 -0700 (Mon, 19 Jun 2006)
ViewCVS: http://svn.sourceforge.net/pmplib/?rev=57&view=rev
Log Message:
-----------
Playlists now work on U10 using POSIX.
Modified Paths:
--------------
trunk/lib/pmp_iriverplus2/playlist.c
Modified: trunk/lib/pmp_iriverplus2/playlist.c
===================================================================
--- trunk/lib/pmp_iriverplus2/playlist.c 2006-06-07 17:17:28 UTC (rev 56)
+++ trunk/lib/pmp_iriverplus2/playlist.c 2006-06-20 02:07:31 UTC (rev 57)
@@ -34,18 +34,39 @@
#include "serialize.h"
#include "ip2db.h"
+// ip2db_findfile: check that a file with path 'filename' can be found in the music database
+// returns 0 if not found.
+// db - the music database
+// filename - the path given in the playlist file
+// path_to_root - encoded mount point prefix
static uint32_t ip2db_findfile(ip2db_t* db, const ucs2char_t *filename, const ucs2char_t *path_to_root)
{
uint8_t *block = NULL;
idx_key_t key;
- ucs2char_t pathname[MAX_PATH], filepart[MAX_PATH];
+ ucs2char_t pathname[MAX_PATH];
+ ucs2char_t filepart[MAX_PATH];
+ ucs2char_t decoded_filename[MAX_PATH];
+ ucs2char_t decoded_filepathname[MAX_PATH];
+ ucs2char_t decoded_pathname[MAX_PATH];
uint32_t leafid;
- ucs2cpy(pathname, filepath_skipdrive(filename, path_to_root));
- filepath_remove_filespec(pathname);
+ // 1. Decode the file path listed in the playlist, including mount point prefix.
+ ucs2cpy(decoded_filename, filename);
+ filepath_decode(decoded_filename);
+
+ // 2. As above, with mount point prefix stripped.
+ ucs2cpy(decoded_filepathname, filepath_skipdrive(decoded_filename, path_to_root));
+
+ // 3. As above, but with filename stripped.
+ ucs2cpy(decoded_pathname, decoded_filepathname);
+ filepath_remove_filespec(decoded_pathname);
+ // The path stored in the database is encoded, need do comparisons against that.
+ ucs2cpy(pathname, decoded_pathname);
filepath_encode(pathname);
- ucs2cpy(filepart, filepath_skippath(filename));
+ // 4. As 2, but with directory path stripped.
+ ucs2cpy(filepart, filepath_skippath(decoded_filepathname));
+
memset(&key, 0, sizeof(key));
key.type = IP2DBIDX_PAGE_NODE_FILENAME;
key.dup = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|