Improve logic for storing paths depending on relativeness

Paths are stored as follows:
    - If absolute paths are passed, then the absolute paths will be stored in the database.
    - If a relative path is passed, and if the path is relative to the user's $HOME directory then a path relative
      to the user's $HOME will be saved instead.
    - If a relative path is passed that is not within the user's $HOME then the absolute path will be stored.

Signed-off-by: Thanh Ha <thanh.ha@alumni.carleton.ca>