forked from XuShaohua/bcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbcloud-gui
More file actions
executable file
·32 lines (26 loc) · 823 Bytes
/
bcloud-gui
File metadata and controls
executable file
·32 lines (26 loc) · 823 Bytes
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
#!/usr/bin/env python3
# Copyright (C) 2014-2015 LiuLang <gsushzhsosgsu@gmail.com>
# Use of this source code is governed by GPLv3 license that can be found
# in http://www.gnu.org/licenses/gpl-3.0.html
import os
import sys
import time
from bcloud.App import App
LOG_INTERVAL = 30 * 86400 # 30 days
def main():
# handle errors
logfile = os.path.expanduser('~/.config/bcloud/bcloud-stderr.log')
dirname = os.path.dirname(logfile)
if not os.path.exists(dirname):
try:
os.makedirs(dirname)
except Exception:
sys.exit(1)
if (os.path.exists(logfile) and
time.time() - os.stat(logfile).st_ctime > LOG_INTERVAL):
os.remove(logfile)
sys.stderr = open(logfile, 'a')
app = App()
app.run(sys.argv)
if __name__ == '__main__':
main()