Commits
Ville Suoranta authored 3c2e1a9f1a2 Merge
603 603 | casalog.post('IterPars : ' + str(self.iterpars), 'INFO2') |
604 604 | |
605 605 | |
606 606 | def incrementImageName(self,imagename): |
607 607 | dirname = '.' |
608 608 | prefix = imagename |
609 609 | |
610 610 | if imagename.count('/'): |
611 611 | splitname = imagename.split('/') |
612 612 | prefix = splitname[ len(splitname)-1 ] |
613 - | dirname = './' + imagename[0: len(imagename)-len(prefix)] # has '/' at end |
613 + | ### if it has a leading / then absolute path is assumed |
614 + | dirname = (imagename[0: len(imagename)-len(prefix)]) if (imagename[0] == '/') else ('./' + imagename[0: len(imagename)-len(prefix)]) # has '/' at end |
614 615 | |
615 616 | inamelist = [fn for fn in os.listdir(dirname) if any([fn.startswith(prefix)])]; |
616 617 | |
617 618 | if len(inamelist)==0: |
618 619 | newimagename = dirname[2:] + prefix |
619 620 | else: |
620 621 | nlen = len(prefix) |
621 622 | maxid=1 |
622 623 | for iname in inamelist: |
623 624 | startind = iname.find( prefix+'_' ) |
638 639 | prefixes={} |
639 640 | |
640 641 | for immod in inpnamelist.keys() : |
641 642 | imagename = inpnamelist[immod] |
642 643 | dirname = '.' |
643 644 | prefix = imagename |
644 645 | |
645 646 | if imagename.count('/'): |
646 647 | splitname = imagename.split('/') |
647 648 | prefix = splitname[ len(splitname)-1 ] |
648 - | dirname = './' + imagename[0: len(imagename)-len(prefix)] # has '/' at end |
649 + | dirname = (imagename[0: len(imagename)-len(prefix)]) if (imagename[0] == '/') else ('./' + imagename[0: len(imagename)-len(prefix)]) # has '/' at end |
650 + | |
649 651 | |
650 652 | dirnames[immod] = dirname |
651 653 | prefixes[immod] = prefix |
652 654 | |
653 655 | |
654 656 | maxid=0 |
655 657 | for immod in inpnamelist.keys() : |
656 658 | prefix = prefixes[immod] |
657 659 | inamelist = [fn for fn in os.listdir(dirnames[immod]) if any([fn.startswith(prefix)])]; |
658 660 | nlen = len(prefix) |