forked from leitwolf/QuickXDev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.py
More file actions
34 lines (28 loc) · 688 Bytes
/
helper.py
File metadata and controls
34 lines (28 loc) · 688 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
33
34
import sublime
import os
import hashlib
import sys
# read content from a file
def readFile(path):
f = open(path, "r")
content = f.read()
f.close()
return content
# write content to a file
def writeFile(path, content):
f = open(path, "w+")
f.write(content)
f.close()
# check file extention
def checkFileExt(file,ext):
ext1 = os.path.splitext(file)[1][1:]
if ext1 == ext:
return True
else:
return False
def md5(str):
return hashlib.md5(str.encode(sys.getfilesystemencoding())).hexdigest()
def isST3():
return sublime.version()[0] == '3'
def loadSettings(name):
return sublime.load_settings(name+".sublime-settings")