Ignore:
Timestamp:
Sep 19, 2018, 5:40:04 PM (15 months ago)
Author:
mabarracus
Message:

Added compatibility with old profiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • syncer/trunk/fuentes/syncer.install/usr/lib/syncer/plugins/plank.py

    r7985 r8099  
    7373            shutil.move(item,newitem)
    7474            os.chmod(newitem,0o0755)
    75             # create element
    76             entry=['[PlankDockItemPreferences]','Launcher=file://'+newitem]
    77             entry=map(lambda x: x+'\n',entry)
    78             with open(os.path.expanduser('~')+'/.config/plank/dock1/launchers/'+basename_item+'.dockitem','w') as f:
    79                 f.writelines(entry)
     75            # maybe it's a dockitem
     76            content = None
     77            with open(newitem,'r') as fp:
     78                content = fp.read()
     79            if 'PlankDockItemPreferences' in content:
     80                with open(os.path.expanduser('~')+'/.config/plank/dock1/launchers/'+basename_item+'.dockitem','w') as f:
     81                    f.write(content)
     82            else:
     83                # create element
     84                entry=['[PlankDockItemPreferences]','Launcher=file://'+newitem]
     85                entry=map(lambda x: x+'\n',entry)
     86                with open(os.path.expanduser('~')+'/.config/plank/dock1/launchers/'+basename_item+'.dockitem','w') as f:
     87                    f.writelines(entry)
    8088            return True,'Added {}'.format(item)
    8189
Note: See TracChangeset for help on using the changeset viewer.