def buildRecentFileMenu():

    if "RecentFilesList" not in core.optionVar:
        return

    # get the list
    RecentFilesList = core.optionVar["RecentFilesList"]
    nNumItems = len(RecentFilesList)
    RecentFilesMaxSize = core.optionVar["RecentFilesMaxSize"]

#        # check if there are too many items in the list
#        if (RecentFilesMaxSize < nNumItems):
#
#            #if so, truncate the list
#            nNumItemsToBeRemoved = nNumItems - RecentFilesMaxSize
#
#            #Begin removing items from the head of the array (least recent file in the list)
#            for ($i = 0; $i < $nNumItemsToBeRemoved; $i++):
#
#                core.optionVar -removeFromArray "RecentFilesList" 0;
#
#            RecentFilesList = core.optionVar["RecentFilesList"]
#            nNumItems = len($RecentFilesList);


    # The RecentFilesTypeList optionVar may not exist since it was
    # added after the RecentFilesList optionVar. If it doesn't exist,
    # we create it and initialize it with a guess at the file type
    if nNumItems > 0 :
        if "RecentFilesTypeList" not in core.optionVar:
            core.mel.initRecentFilesTypeList( RecentFilesList )

        RecentFilesTypeList = core.optionVar["RecentFilesTypeList"]


    #toNativePath
    # first, check if we are the same.
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/tools/ipymel.py/buildRecentFileMenu/original