File: wb_platform_macosx_specific.py

package info (click to toggle)
svn-workbench 1.6.8-2.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,172 kB
  • ctags: 2,147
  • sloc: python: 15,925; sh: 108; makefile: 15; ansic: 9
file content (70 lines) | stat: -rw-r--r-- 1,718 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
'''

 ====================================================================
 Copyright (c) 2004-2010 Barry A Scott.  All rights reserved.

 This software is licensed as described in the file LICENSE.txt,
 which you should have received as part of this distribution.

 ====================================================================


    wb_platform_macosx_specific.py

'''
import os
import types

def getApplicationDir():
    return os.path.join( os.environ['HOME'], 'Library/Preferences/org.tigris.pysvn.Workbench' )

def getLocalePath( app ):
    return os.path.join( os.environ.get( 'PYTHONHOME', app.app_dir ), 'locale' )

def getNullDevice():
    return '/dev/null'

def uPathExists( path ):
    if type(path) == types.UnicodeType:
        path = path.encode( 'utf-8' )

    return os.path.exists( path )

def uPathIsdir( path ):
    if type(path) == types.UnicodeType:
        path = path.encode( 'utf-8' )

    return os.path.isdir( path )

def uAccess( path, mode ):
    if type(path) == types.UnicodeType:
        path = path.encode( 'utf-8' )

    return os.access( path, mode )

def uRemove( path ):
    if type(path) == types.UnicodeType:
        path = path.encode( 'utf-8' )

    return os.remove( path )

def uRename( path1, path2 ):
    if type(path1) == types.UnicodeType:
        path1 = path1.encode( 'utf-8' )

    if type(path2) == types.UnicodeType:
        path2 = path2.encode( 'utf-8' )

    return os.rename( path1, path2 )

def uOpen( path, mode ):
    if type(path) == types.UnicodeType:
        path = path.encode( 'utf-8' )

    return open( path, mode )

def uChdir( path ):
    if type(path) == types.UnicodeType:
        path = path.encode( 'utf-8' )

    return os.chdir( path )