locked
IFsiDirectoryItem::AddFile RRS feed

  • Question

  • Seems to add the correct data for the file, but for some reason it wants to mange the file name.    

    002.jpg   get's written on the disk as 002~1.jpg#CA7B

    If I add entire Tree structure, every directory and file is correct.  None of the filenames have been altered.

    Anyone got any ideas as to why?  Or how to prevent it.

    Thursday, December 16, 2010 5:47 PM

Answers

  • I decided to try BSTR instead.   It didn't work either ... but in the process of stepping through the debugger, I noticed that the string being passed in is really 002.jpg followed by a number of blank characters.   Thus, you were right: not supported by the target FileSystem.

    I got rid of the trailing blanks and it all worked fine.

     

    Thanks for advice,

     

    Tom

    • Marked as answer by Tom Apeland Wednesday, February 16, 2011 10:06 PM
    Wednesday, February 16, 2011 6:43 PM

All replies

  • Hi Tom,

    Could you provide us with exact repro steps (code with data) and your environment details (OS/feature pack, drive/media info etc), in order to investigate the issue.

    Thank you,
    Mikhail

    Monday, December 20, 2010 8:30 PM
  • Sorry I took so long to respond to your request.   I was out over the holidays.

    It is happening on Windows 7 Professional.   I have tried it on several different drives: MATSHITA, DVD+-RW UJ862A, PLEXTOR , CD-R PX-W4824A, and a SONYDVD RW DRU-830A.   Happens with both CDR and DVD media.

    Here is the code that is actually calling AddFile

    IFsiDirectoryItem *item = GetIFsiDirectoryItem( ToPath );

    TCHAR FileName[256];

    lastToken( ToPath,_T("\\"),FileName );

    ImageMasteringFileObject *fileObj = new ImageMasteringFileObject();

    fileObj->SetPath(FromPath);

    _bstr_t fileName(FileName); // FileName is 002.jpg at this point

    fHRESULT = item->AddFile( fileName.GetBSTR(),fileObj->GetStream() );

    fFileArray.Add(fileObj);

    item->Release();

     

    thanks in advance for any insights you can provide

    Monday, January 3, 2011 4:58 PM
  • I did supply the code and operating environment.   Did you have any ideas on what might be wrong?
    Tuesday, February 15, 2011 1:49 PM
  • Hi Tom,

    According to your description there seems to be wrong FileName supplied. IMAPI does change the filename in case if there are any unsupported (by target FileSystem) characters. I'd suggest to try to use
    CComBSTR fileName("002.jpg");
    instead of "_bstr_t fileName(FileName);"

    Regards,
    Mikhail

    Wednesday, February 16, 2011 6:10 PM
  • Yeah I had tried CComBSTR first as I prefer it over _bstr_t.  But I get the same result.   The target file system is UDF.   So I don't there there any illegal characters involved.

     

    any other ideas?

     

    Tom

    Wednesday, February 16, 2011 6:25 PM
  • I decided to try BSTR instead.   It didn't work either ... but in the process of stepping through the debugger, I noticed that the string being passed in is really 002.jpg followed by a number of blank characters.   Thus, you were right: not supported by the target FileSystem.

    I got rid of the trailing blanks and it all worked fine.

     

    Thanks for advice,

     

    Tom

    • Marked as answer by Tom Apeland Wednesday, February 16, 2011 10:06 PM
    Wednesday, February 16, 2011 6:43 PM
  • glad that helped
    Wednesday, February 16, 2011 10:18 PM