Commit inicial: fuentes MBS ERP (Genero 6) + .gitignore + docs/SETUP_PC_MBS.md
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
IMPORT os
|
||||
|
||||
DEFINE log_file_fp STRING -- log filename full path
|
||||
DEFINE writ_dir_fp STRING -- writable dir full path
|
||||
|
||||
FUNCTION init_mobile_log(lfn)
|
||||
|
||||
DEFINE lfn STRING -- log filename
|
||||
|
||||
IF is_mobile_disconnected() THEN
|
||||
|
||||
LET writ_dir_fp=os.path.pwd()
|
||||
|
||||
IF ui.Interface.getFrontEndName()=="GMA" THEN
|
||||
-- on GMA in deployed mode os.path.pwd returns the same as base.Application.getProgramDir
|
||||
LET writ_dir_fp=os.path.fullPath(os.path.join(writ_dir_fp,"Documents"))
|
||||
-- so the "Documents" sub-folder must be added and created (the first time)
|
||||
CALL create_wr_folder(writ_dir_fp)
|
||||
END IF
|
||||
|
||||
ELSE
|
||||
|
||||
LET writ_dir_fp=base.Application.getProgramDir()
|
||||
|
||||
END IF
|
||||
|
||||
LET log_file_fp=os.path.fullPath(os.path.join(writ_dir_fp,lfn))
|
||||
|
||||
CALL startlog(log_file_fp)
|
||||
|
||||
END FUNCTION
|
||||
|
||||
# Returns logfile name with full path
|
||||
FUNCTION get_logname()
|
||||
RETURN log_file_fp
|
||||
END FUNCTION
|
||||
|
||||
# Returns full path of writable dir for mobile apps
|
||||
FUNCTION get_wr_dir()
|
||||
RETURN writ_dir_fp
|
||||
END FUNCTION
|
||||
|
||||
PRIVATE FUNCTION create_wr_folder(wrd)
|
||||
|
||||
DEFINE wrd STRING -- writable directory
|
||||
DEFINE ret BOOLEAN
|
||||
|
||||
CALL os.Path.exists(wrd) RETURNING ret
|
||||
|
||||
IF NOT(ret) THEN
|
||||
-- if it doesn't exist it creates the folder
|
||||
CALL os.Path.mkdir(wrd) RETURNING ret
|
||||
END IF
|
||||
|
||||
END FUNCTION
|
||||
|
||||
FUNCTION is_mobile_disconnected()
|
||||
|
||||
-- this function returns true when it's a mobile device
|
||||
-- and it's running in disconnected mode
|
||||
-- it's on a function just in case it changes again
|
||||
|
||||
RETURN base.Application.isMobile()
|
||||
|
||||
END FUNCTION
|
||||
Reference in New Issue
Block a user