Add Android (with QPython3) support

This commit is contained in:
clamsawd 2016-02-16 15:53:39 +01:00
parent 92a3e4c350
commit 317d575a90
3 changed files with 22 additions and 8 deletions

View File

@ -5,7 +5,7 @@
# ip2e (IP to email) - Create the configuration file. | # ip2e (IP to email) - Create the configuration file. |
# Created by clamsawd (clamsawd@openmailbox.org) | # Created by clamsawd (clamsawd@openmailbox.org) |
# Licensed by GPL v.3 | # Licensed by GPL v.3 |
# Last update: 01-12-2015 | # Last update: 16-02-2016 |
# | # |
# Compatible with Python 3.x | # Compatible with Python 3.x |
# -------------------------------------------------------------- # --------------------------------------------------------------
@ -34,9 +34,13 @@ def ClearScreen():
print ("Error: Unable clear screen") print ("Error: Unable clear screen")
#Detect system & PATH of user folder #Detect system & PATH of user folder
if os.name == "posix": if os.path.exists("/storage/sdcard0"):
HOMESCARD0="/storage/sdcard0/Android/data"
os.chdir(HOMESCARD0)
print ("Android (Posix) detected")
elif os.name == "posix":
os.chdir(os.environ["HOME"]) os.chdir(os.environ["HOME"])
print ("POSIX detected") print ("Unix (Posix) detected")
elif os.name == "nt": elif os.name == "nt":
os.chdir(os.environ["USERPROFILE"]) os.chdir(os.environ["USERPROFILE"])
print ("Windows detected") print ("Windows detected")

View File

@ -39,11 +39,17 @@ def ClearScreen():
print ("Error: Unable clear screen") print ("Error: Unable clear screen")
#Detect system & PATH of user folder #Detect system & PATH of user folder
if os.name == "posix": if os.path.exists("/storage/sdcard0"):
HOMESCARD0="/storage/sdcard0/Android/data"
os.chdir(HOMESCARD0)
LogFile=HOMESCARD0+"/ip2e/ip2e.log"
LockFile=HOMESCARD0+"/ip2e/ip2e.lock"
print ("Android (Posix) detected")
elif os.name == "posix":
os.chdir(os.environ["HOME"]) os.chdir(os.environ["HOME"])
LogFile=os.environ["HOME"]+"/.ip2e/ip2e.log" LogFile=os.environ["HOME"]+"/.ip2e/ip2e.log"
LockFile=os.environ["HOME"]+"/.ip2e/ip2e.lock" LockFile=os.environ["HOME"]+"/.ip2e/ip2e.lock"
print ("POSIX detected") print ("Unix (Posix) detected")
elif os.name == "nt": elif os.name == "nt":
os.chdir(os.environ["USERPROFILE"]) os.chdir(os.environ["USERPROFILE"])
LogFile=os.environ["USERPROFILE"]+"\\.ip2e\\ip2e.log" LogFile=os.environ["USERPROFILE"]+"\\.ip2e\\ip2e.log"

View File

@ -5,7 +5,7 @@
# ip2e (IP to email) - See the log file. | # ip2e (IP to email) - See the log file. |
# Created by clamsawd (clamsawd@openmailbox.org) | # Created by clamsawd (clamsawd@openmailbox.org) |
# Licensed by GPL v.3 | # Licensed by GPL v.3 |
# Last update: 01-12-2015 | # Last update: 16-02-2016 |
# | # |
# Compatible with Python 3.x | # Compatible with Python 3.x |
# -------------------------------------------------------------- # --------------------------------------------------------------
@ -34,9 +34,13 @@ def ClearScreen():
print ("Error: Unable clear screen") print ("Error: Unable clear screen")
#Detect system & PATH of user folder #Detect system & PATH of user folder
if os.name == "posix": if os.path.exists("/storage/sdcard0"):
HOMESCARD0="/storage/sdcard0/Android/data"
os.chdir(HOMESCARD0)
print ("Android (Posix) detected")
elif os.name == "posix":
os.chdir(os.environ["HOME"]) os.chdir(os.environ["HOME"])
print ("POSIX detected") print ("Unix (Posix) detected")
elif os.name == "nt": elif os.name == "nt":
os.chdir(os.environ["USERPROFILE"]) os.chdir(os.environ["USERPROFILE"])
print ("Windows detected") print ("Windows detected")