VirtualBox

Changeset 4306 in vbox


Ignore:
Timestamp:
Aug 23, 2007 10:14:15 AM (17 years ago)
Author:
vboxsync
Message:

Main: Rotate VBox.png[.N] files (that may have been created by the GUI) as well.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r4297 r4306  
    71157115        Utf8Str logFile = Utf8StrFmt ("%s%cVBox.log",
    71167116                                      logDir.raw(), RTPATH_DELIMITER);
     7117        Utf8Str pngFile = Utf8StrFmt ("%s%cVBox.png",
     7118                                      logDir.raw(), RTPATH_DELIMITER);
    71177119
    71187120        /*
     
    71237125        for (int i = 2; i >= 0; i--)
    71247126        {
    7125             Utf8Str oldName;
    7126             if (i > 0)
    7127                 oldName = Utf8StrFmt ("%s.%d", logFile.raw(), i);
    7128             else
    7129                 oldName = logFile;
    7130             Utf8Str newName = Utf8StrFmt ("%s.%d", logFile.raw(), i + 1);
    7131             RTFileRename(oldName.raw(), newName.raw(), RTFILEMOVE_FLAGS_REPLACE);
     7127            Utf8Str *files[] = { &logFile, &pngFile };
     7128            Utf8Str oldName, newName;
     7129
     7130            for (int j = 0; j < ELEMENTS (files); ++ j)
     7131            {
     7132                if (i > 0)
     7133                    oldName = Utf8StrFmt ("%s.%d", files [j]->raw(), i);
     7134                else
     7135                    oldName = *files [j];
     7136                newName = Utf8StrFmt ("%s.%d", files [j]->raw(), i + 1);
     7137                /* If the old file doesn't exist, delete the new file (if it
     7138                 * exists) to provide correct rotation even if the sequence is
     7139                 * broken */
     7140                if (RTFileRename (oldName, newName, RTFILEMOVE_FLAGS_REPLACE) ==
     7141                    VERR_FILE_NOT_FOUND)
     7142                    RTFileDelete (newName);
     7143            }
    71327144        }
    71337145
  • trunk/src/VBox/Main/MachineImpl.cpp

    r4071 r4306  
    22422242        if (RTDirExists (logFolder))
    22432243        {
    2244             /* delete all VBox.log[.N] files from the Logs folder
     2244            /* Delete all VBox.log[.N] files from the Logs folder
    22452245             * (this must be in sync with the rotation logic in
    2246              * Console::powerUpThread()) */
     2246             * Console::powerUpThread()). Also, delete the VBox.png[.N]
     2247             * files that may have been created by the GUI. */
    22472248            Utf8Str log = Utf8StrFmt ("%s/VBox.log", logFolder.raw());
     2249            RTFileDelete (log);
     2250            log = Utf8StrFmt ("%s/VBox.png", logFolder.raw());
    22482251            RTFileDelete (log);
    22492252            for (int i = 3; i >= 0; i--)
    22502253            {
    22512254                log = Utf8StrFmt ("%s/VBox.log.%d", logFolder.raw(), i);
     2255                RTFileDelete (log);
     2256                log = Utf8StrFmt ("%s/VBox.png.%d", logFolder.raw(), i);
    22522257                RTFileDelete (log);
    22532258            }
Note: See TracChangeset for help on using the changeset viewer.

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