Ejemplo n.º 1
0
    class Stderr(baseclass):
        logroot = get_home_dir()

        if logroot is None:
            logroot = os.path.splitdrive(sys.executable)[0]
            if logroot[-1] != os.sep:
                logroot += os.sep
        logname = os.path.splitext(os.path.split(
            sys.executable)[1])[0] + '_errors.log'
        logpath = os.path.join(logroot, logname)

        def __init__(self):
            self.just_wrote_newline = True

        def write(self, text, alert=None, fname=logpath):
            output = text

            if self.just_wrote_newline and not text.startswith(
                    '[%s ' % version):
                output = '[%s %s] %s' % (
                    version, time.strftime('%Y-%m-%d %H:%M:%S'), text)

            if 'GtkWarning' not in text:
                baseclass.write(self, output, fname=fname)

            if output[-1] == '\n':
                self.just_wrote_newline = True
            else:
                self.just_wrote_newline = False
Ejemplo n.º 2
0
def get_home_dir():
    return decode_from_filesystem(platform.get_home_dir())
Ejemplo n.º 3
0
def get_home_dir():
  return decode_from_filesystem(platform.get_home_dir())
Ejemplo n.º 4
0
# may obtain a copy of the License at http://www.bittorrent.com/license/.
#
# Software distributed under the License is distributed on an AS IS basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
# for the specific language governing rights and limitations under the
# License.

# written by Matt Chisholm

import os
import sys

from BitTorrent.platform import get_home_dir, get_shell_dir
if os.name == 'nt':
    from win32com.shell import shellcon
    
desktop = None

if os.name == 'nt':
    desktop = get_shell_dir(shellcon.CSIDL_DESKTOPDIRECTORY)
else:
    homedir = get_home_dir()
    if homedir == None :
        desktop = '/tmp/'
    else:
        desktop = homedir
        if os.name in ('mac', 'posix'):
            tmp_desktop = os.path.join(homedir, 'Desktop')
            if os.access(tmp_desktop, os.R_OK|os.W_OK):
                desktop = tmp_desktop + os.sep
Ejemplo n.º 5
0
# may obtain a copy of the License at http://www.bittorrent.com/license/.
#
# Software distributed under the License is distributed on an AS IS basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
# for the specific language governing rights and limitations under the
# License.

# written by Matt Chisholm

import os
import sys

from BitTorrent.platform import get_home_dir, get_shell_dir
if os.name == 'nt':
    from win32com.shell import shellcon

desktop = None

if os.name == 'nt':
    desktop = get_shell_dir(shellcon.CSIDL_DESKTOPDIRECTORY)
else:
    homedir = get_home_dir()
    if homedir == None:
        desktop = '/tmp/'
    else:
        desktop = homedir
        if os.name in ('mac', 'posix'):
            tmp_desktop = os.path.join(homedir, 'Desktop')
            if os.access(tmp_desktop, os.R_OK | os.W_OK):
                desktop = tmp_desktop + os.sep