Skip to content

Commit

Permalink
Checking platform on _filename_to_module function:
Browse files Browse the repository at this point in the history
This allows for using the correctly `os.sep` instead of `os.path.sep` that leads to the error tito#8
  • Loading branch information
FilipeMarch committed Oct 3, 2022
1 parent a9214b4 commit ff1257a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kaki/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from kivy.factory import Factory
from kivy.lang import Builder
from kivy.base import ExceptionHandler, ExceptionManager
from kivy.utils import platform
try:
from monotonic import monotonic
except ImportError:
Expand Down Expand Up @@ -307,9 +308,13 @@ def _filename_to_module(self, filename):
rootpath = self.get_root_path()
if filename.startswith(rootpath):
filename = filename[len(rootpath):]
if filename.startswith(os.path.sep):
if platform == 'macosx':
prefix = os.sep
else:
prefix = os.path.sep
if filename.startswith(prefix):
filename = filename[1:]
module = filename[:-3].replace(os.path.sep, ".")
module = filename[:-3].replace(prefix, ".")
Logger.debug("{}: Translated {} to {}".format(
self.appname, orig_filename, module))
return module
Expand Down

0 comments on commit ff1257a

Please sign in to comment.