Update of /cvsroot/audacity/audacity-src/src/blockfile
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv10019

Modified Files:
      Tag: Audacity_UmixIt
        PCMAliasBlockFile.cpp 
Log Message:
Fallback to look for the filename, located in the data directory, if full 
pathname not found. This allows alias files to just be kept there and 
stay with the project if it's moved.

Index: PCMAliasBlockFile.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/blockfile/PCMAliasBlockFile.cpp,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.1.4.1
diff -u -d -r1.4.2.1 -r1.4.2.1.4.1
--- PCMAliasBlockFile.cpp       21 Apr 2004 23:33:54 -0000      1.4.2.1
+++ PCMAliasBlockFile.cpp       23 Nov 2006 03:56:21 -0000      1.4.2.1.4.1
@@ -38,6 +38,8 @@
 {
 }
 
+wxString gProjDir = ""; // Needs to be set in BuildFromXML, so just use a 
global instead of a member.
+
 /// Reads the specified data from the aliased file, using libsndfile,
 /// and converts it to the given sample format.
 ///
@@ -51,9 +53,14 @@
    SF_INFO info;
 
    memset(&info, 0, sizeof(info));
-   SNDFILE *sf = sf_open(FILENAME(mAliasedFileName.GetFullPath()),
-                         SFM_READ, &info);
 
+   wxString strFullPath = mAliasedFileName.GetFullPath();
+   SNDFILE *sf = sf_open(FILENAME(strFullPath), SFM_READ, &info);
+   if (!sf) {
+      // Allow fallback of looking for the file name, located in the data 
directory.
+      strFullPath = gProjDir + "\\" + mAliasedFileName.GetFullName(); 
+      sf = sf_open(FILENAME(strFullPath), SFM_READ, &info);
+   }
    if (!sf)
       return 0;
 
@@ -128,6 +135,8 @@
 
 BlockFile *PCMAliasBlockFile::BuildFromXML(wxString projDir, const char 
**attrs)
 {
+   gProjDir = projDir;
+
    wxFileName summaryFileName;
    wxFileName aliasFileName;
    int aliasStart=0, aliasLen=0, aliasChannel=0;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to