changeset 75:b84dadbab62b

core: added a platform check in on_start: on_start is also called on non-android platform, so a check has been added to ignore android-specific code
author Goffi <goffi@goffi.org>
date Tue, 20 Dec 2016 21:10:53 +0100
parents 88e3071079a7
children a766c278b640
files src/cagou/core/cagou_main.py
diffstat 1 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/cagou/core/cagou_main.py	Mon Dec 19 23:50:19 2016 +0100
+++ b/src/cagou/core/cagou_main.py	Tue Dec 20 21:10:53 2016 +0100
@@ -228,18 +228,19 @@
         return os.path.expanduser(path).format(*args, media=self.host.media_dir, **kwargs)
 
     def on_start(self):
-        # XXX: we use memory map instead of bridge because if we try to call a bridge method
-        #      in on_pause method, the call data  is not written before the actual pause
-        # we create a memory map on .cagou_status file with a 1 byte status
-        # status is:
-        # R => running
-        # P => paused
-        # S => stopped
-        self._first_pause = True
-        self.cagou_status_fd = open('.cagou_status', 'wb+')
-        self.cagou_status_fd.write('R')
-        self.cagou_status_fd.flush()
-        self.cagou_status = mmap.mmap(self.cagou_status_fd.fileno(), 1, prot=mmap.PROT_WRITE)
+        if sys.platform == "android":
+            # XXX: we use memory map instead of bridge because if we try to call a bridge method
+            #      in on_pause method, the call data  is not written before the actual pause
+            # we create a memory map on .cagou_status file with a 1 byte status
+            # status is:
+            # R => running
+            # P => paused
+            # S => stopped
+            self._first_pause = True
+            self.cagou_status_fd = open('.cagou_status', 'wb+')
+            self.cagou_status_fd.write('R')
+            self.cagou_status_fd.flush()
+            self.cagou_status = mmap.mmap(self.cagou_status_fd.fileno(), 1, prot=mmap.PROT_WRITE)
 
     def on_pause(self):
         self.cagou_status[0] = 'P'