Skip to content

Commit

Permalink
Refactored _get_capture_filename to work cross-platform, fixes #11 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
vesche authored and kitao committed Aug 2, 2018
1 parent 0eb1d24 commit ea462c6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pyxel/app.py
Expand Up @@ -2,7 +2,7 @@
import math
import os
import time

import platform
import glfw
import PIL.Image

Expand Down Expand Up @@ -350,12 +350,19 @@ def _get_pil_palette(palette):

@staticmethod
def _get_capture_filename():
if os.name == 'nt':
plat = platform.system()

if plat == 'Windows':
path = os.path.join(
os.path.join(os.environ['USERPROFILE']), 'Desktop')
elif plat == 'Darwin':
path = os.path.join(
os.path.join(os.path.expanduser('~')), 'Desktop')
else:
path = os.path.join(
os.path.join(os.path.expanduser('~')), 'Desktop')
if not os.path.exists(path):
path = os.path.expanduser('~')

return os.path.join(
path,
Expand Down

0 comments on commit ea462c6

Please sign in to comment.