VirtualBox

Changeset 63629 in vbox


Ignore:
Timestamp:
Aug 24, 2016 2:33:27 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
110352
Message:

Audio/DrvHostDebugAudio.cpp: Use RTPathTemp() for retrieving the temporary directory, logging.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostDebugAudio.cpp

    r63534 r63629  
    167167    if (RT_SUCCESS(rc))
    168168    {
    169         char szFile[RTPATH_MAX];
    170         rc = DrvAudioHlpGetFileName(szFile, RT_ELEMENTS(szFile), "/tmp/", NULL, PDMAUDIOFILETYPE_WAV);
     169        char szTemp[RTPATH_MAX];
     170        rc = RTPathTemp(szTemp, sizeof(szTemp));
    171171        if (RT_SUCCESS(rc))
    172172        {
    173             LogRel(("DebugAudio: Creating output file '%s'\n", szFile));
    174             rc = DrvAudioHlpWAVFileOpen(&pDbgStream->File, szFile,
    175                                         RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE,
    176                                         &Props, PDMAUDIOFILEFLAG_NONE);
    177             if (RT_FAILURE(rc))
    178                 LogRel(("DebugAudio: Creating output file '%s' failed with %Rrc\n", szFile, rc));
     173            char szFile[RTPATH_MAX];
     174            rc = DrvAudioHlpGetFileName(szFile, RT_ELEMENTS(szFile), szTemp, NULL, PDMAUDIOFILETYPE_WAV);
     175            if (RT_SUCCESS(rc))
     176            {
     177                LogFlowFunc(("%s\n", szFile));
     178                rc = DrvAudioHlpWAVFileOpen(&pDbgStream->File, szFile,
     179                                            RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE,
     180                                            &Props, PDMAUDIOFILEFLAG_NONE);
     181                if (RT_FAILURE(rc))
     182                    LogRel(("DebugAudio: Creating output file '%s' failed with %Rrc\n", szFile, rc));
     183            }
     184            else
     185                LogRel(("DebugAudio: Unable to build file name for temp dir '%s': %Rrc\n", szTemp, rc));
    179186        }
     187        else
     188            LogRel(("DebugAudio: Unable to retrieve temp dir: %Rrc\n", rc));
    180189    }
    181190
     
    327336    {
    328337        /* Delete the file again if nothing but the header was written to it. */
    329         if (!cbDataSize)
    330             rc = RTFileDelete(pDbgStream->File.szName); /** @todo Make deletion configurable? */
     338        bool fDeleteEmptyFiles = true; /** @todo Make deletion configurable? */
     339
     340        if (   !cbDataSize
     341            && fDeleteEmptyFiles)
     342        {
     343            rc = RTFileDelete(pDbgStream->File.szName);
     344        }
     345        else
     346            LogRel(("DebugAudio: Created output file '%s' (%zu bytes)\n", pDbgStream->File.szName, cbDataSize));
    331347    }
    332348
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette