From 317d575a90c47dab92f7a522ad7327f1cf846f98 Mon Sep 17 00:00:00 2001 From: clamsawd Date: Tue, 16 Feb 2016 15:53:39 +0100 Subject: [PATCH] Add Android (with QPython3) support --- ip2e-config.py | 10 +++++++--- ip2e-daemon.py | 10 ++++++++-- ip2e-log.py | 10 +++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ip2e-config.py b/ip2e-config.py index b61fab6..e1ac990 100755 --- a/ip2e-config.py +++ b/ip2e-config.py @@ -5,7 +5,7 @@ # ip2e (IP to email) - Create the configuration file. | # Created by clamsawd (clamsawd@openmailbox.org) | # Licensed by GPL v.3 | -# Last update: 01-12-2015 | +# Last update: 16-02-2016 | # | # Compatible with Python 3.x | # -------------------------------------------------------------- @@ -34,9 +34,13 @@ def ClearScreen(): print ("Error: Unable clear screen") #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"]) - print ("POSIX detected") + print ("Unix (Posix) detected") elif os.name == "nt": os.chdir(os.environ["USERPROFILE"]) print ("Windows detected") diff --git a/ip2e-daemon.py b/ip2e-daemon.py index f85fc8c..feed2f3 100755 --- a/ip2e-daemon.py +++ b/ip2e-daemon.py @@ -39,11 +39,17 @@ def ClearScreen(): print ("Error: Unable clear screen") #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"]) LogFile=os.environ["HOME"]+"/.ip2e/ip2e.log" LockFile=os.environ["HOME"]+"/.ip2e/ip2e.lock" - print ("POSIX detected") + print ("Unix (Posix) detected") elif os.name == "nt": os.chdir(os.environ["USERPROFILE"]) LogFile=os.environ["USERPROFILE"]+"\\.ip2e\\ip2e.log" diff --git a/ip2e-log.py b/ip2e-log.py index 467a8b4..2100957 100755 --- a/ip2e-log.py +++ b/ip2e-log.py @@ -5,7 +5,7 @@ # ip2e (IP to email) - See the log file. | # Created by clamsawd (clamsawd@openmailbox.org) | # Licensed by GPL v.3 | -# Last update: 01-12-2015 | +# Last update: 16-02-2016 | # | # Compatible with Python 3.x | # -------------------------------------------------------------- @@ -34,9 +34,13 @@ def ClearScreen(): print ("Error: Unable clear screen") #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"]) - print ("POSIX detected") + print ("Unix (Posix) detected") elif os.name == "nt": os.chdir(os.environ["USERPROFILE"]) print ("Windows detected")