VirtualBox

Changeset 72755 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Jun 29, 2018 8:36:29 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123291
Message:

testdriver/base.py: Implemented the extract action.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/base.py

    r72745 r72755  
    13951395        Returns a success indicator and error details with the reporter.
    13961396
    1397         Usually no need to override this.
    1398         """
    1399         reporter.error('the extract action is not implemented')
    1400         return False;
     1397        There is usually no need to override this.
     1398        """
     1399        fRc = True;
     1400        asRsrcs = self.getResourceSet();
     1401        for iRsrc, sRsrc in enumerate(asRsrcs):
     1402            reporter.log('Resource #%s: "%s"' % (iRsrc, sRsrc));
     1403            sSrcPath = os.path.normpath(os.path.abspath(os.path.join(self.sResourcePath, sRsrc.replace('/', os.path.sep))));
     1404            sDstPath = os.path.normpath(os.path.join(self.sExtractDstPath, sRsrc.replace('/', os.path.sep)));
     1405
     1406            sDstDir = os.path.dirname(sDstPath);
     1407            if not os.path.exists(sDstDir):
     1408                try:    os.makedirs(sDstDir, 0o775);
     1409                except: fRc = reporter.errorXcpt('Error creating directory "%s":' % (sDstDir,));
     1410
     1411            if os.path.isfile(sSrcPath):
     1412                try:    utils.copyFileSimple(sSrcPath, sDstPath);
     1413                except: fRc = reporter.errorXcpt('Error copying "%s" to "%s":' % (sSrcPath, sDstPath,));
     1414            elif os.path.isdir(sSrcPath):
     1415                fRc = reporter.error('Extracting directories have not been implemented yet');
     1416            else:
     1417                fRc = reporter.error('Missing or unsupported resource type: %s' % (sSrcPath,));
     1418        return fRc;
    14011419
    14021420    def actionVerify(self):
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