---
- name: Ensure ~/Applications directory exists
  become_user: "{{ user.username }}"
  file:
    mode: 0700
    path: ~/Applications
    state: directory

- name: "Ensure {{ app_name }}'s AppImage is copied"
  become_user: "{{ user.username }}"
  copy:
    src: "{{ appiumdesktop_src_path }}/{{ appimage_name }}"
    dest: ~/Applications
    mode: preserve
    remote_src: true

- name: "Ensure {{ app_name }}'s AppImage is updated"
  become_user: "{{ user.username }}"
  lineinfile:
    path: "~/Applications/{{ appimage_name }}"
    regex: '\./{{ appimage_name }}'
    line: "{{ appiumdesktop_src_path }}/{{ appimage_name }}"
