- name: Copy files
  when: not closed_source_vscode
  copy:
    src: "files/{{ item.src }}"
    dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
    mode: 0600
    owner: "{{ account_name.stdout }}"
    group: "{{ group_name.stdout }}"
  loop:
    # Support wayland
    - src: code-flags.conf
      dest: .config/code-flags.conf

- name: Create directories
  when: closed_source_vscode
  file:
    name: "{{ account_homedir.stdout }}/{{ item }}"
    state: directory
    mode: 0700
    owner: "{{ account_name.stdout }}"
    group: "{{ group_name.stdout }}"
  loop:
    - .config/Code/User

- name: Copy files
  when: closed_source_vscode
  copy:
    src: "files/{{ item.src }}"
    dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
    mode: 0644
    owner: "{{ account_name.stdout }}"
    group: "{{ group_name.stdout }}"
  loop:
    - src: keybindings.json
      dest: .config/Code/User/keybindings.json
    - src: settings.json
      dest: .config/Code/User/settings.json

- name: Create directories
  when: not closed_source_vscode
  file:
    name: "{{ account_homedir.stdout }}/{{ item }}"
    state: directory
    mode: 0700
    owner: "{{ account_name.stdout }}"
    group: "{{ group_name.stdout }}"
  loop:
    - .config/Code - OSS/User

- name: Copy files
  when: not closed_source_vscode
  copy:
    src: "files/{{ item.src }}"
    dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
    mode: 0600
    owner: "{{ account_name.stdout }}"
    group: "{{ group_name.stdout }}"
  loop:
    - src: keybindings.json
      dest: .config/Code - OSS/User/keybindings.json
    - src: settings.json
      dest: .config/Code - OSS/User/settings.json
