Beispiel #1
0
def delete(file):
  if exists(file):
    os.remove(
      io.absolute_path(file, __dirname)
    )
    return True
  return False
Beispiel #2
0
def write(data, file):
  file_existed = True if exists(file) else False
  io.write_file(
    data,
    io.absolute_path(file, __dirname),
  )
  return file_existed
Beispiel #3
0
def exists(file = '', isState = False):
  file = io.absolute_path(file, __dirname, isState)
  return os.path.exists(file)
Beispiel #4
0
def get_state(file = 'state'):
  if exists(file, True):
    return io.readFile(io.absolute_path(file, __dirname, True))
  return False
Beispiel #5
0
def set_state(data):
  return io.write_file(
    data,
    io.absolute_path('state', __dirname, True),
  )
Beispiel #6
0
def read(file):
  if exists(file):
    return io.readFile(
      io.absolute_path(file, __dirname),
    )