buildframework/helium/tools/common/python/scripts/searchnextdrive.py
changeset 1 be27ed110b50
child 179 d8ac696cc51f
equal deleted inserted replaced
0:044383f39525 1:be27ed110b50
       
     1 #============================================================================ 
       
     2 #Name        : searchnextdrive.py 
       
     3 #Part of     : Helium 
       
     4 
       
     5 #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     6 #All rights reserved.
       
     7 #This component and the accompanying materials are made available
       
     8 #under the terms of the License "Eclipse Public License v1.0"
       
     9 #which accompanies this distribution, and is available
       
    10 #at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    11 #
       
    12 #Initial Contributors:
       
    13 #Nokia Corporation - initial contribution.
       
    14 #
       
    15 #Contributors:
       
    16 #
       
    17 #Description:
       
    18 #===============================================================================
       
    19 
       
    20 """
       
    21     Script that prints the next free drive on the current system.
       
    22     If none available it returns "Error: No free drive!". 
       
    23     win32 only!
       
    24 """
       
    25 import string
       
    26 from win32api import GetLogicalDriveStrings
       
    27 
       
    28 DRIVE_LABELS = sorted(list(set(string.ascii_uppercase) - set(GetLogicalDriveStrings())), reverse=True)
       
    29 if len(DRIVE_LABELS) != 0 :
       
    30     print DRIVE_LABELS[0] + ":"
       
    31 else:
       
    32     print "Error: No free drive!"
       
    33         
       
    34