~webapps/unity-webapps-youtube/trunk

« back to all changes in this revision

Viewing changes to scripts/update-desktop-file-exec-line.py

  • Committer: Alexandre Abreu
  • Date: 2013-09-12 13:08:16 UTC
  • Revision ID: alexandre.abreu@canonical.com-20130912130816-pb05borxz0bh0c1w
Add session migration script

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
1
#!/usr/bin/python
3
2
from gi.repository import Gio
4
3
import os
24
23
        desktop_file_content = open(desktop_filename).read()
25
24
        if desktop_file_content.find('unity-webapps-runner') != -1:
26
25
            updated_desktop_file_content = re.sub(r"Exec\s*=\s*unity-webapps-runner\s*-n\s*'([^\s]*)'.*%u",
27
 
                                                  r"Exec=webbrowser-app --chromeless --webapp='' --app-id='{0}'".format(APP_ID),
 
26
                                                  r"Exec=webbrowser-app --chromeless --webapp='\1' --app-id='{0}'".format(APP_ID),
28
27
                                                  desktop_file_content)
29
28
            open(desktop_filename, "w+").write(updated_desktop_file_content)
30
29
    except Exception, e:
32
31
 
33
32
if __name__ == "__main__":
34
33
    update_desktop_file_exec_line()
35
 
    
 
 
b'\\ No newline at end of file'
 
34