[!windows] skip 'Windows only'

unix2dos golden/apply
unix2dos golden/archive

# test that scripts in subdirectories are run in the subdirectory
chezmoi apply --force
cmpenv stdout golden/apply

chezmoi dump
cmp stdout golden/dump

chezmoi archive --gzip --output=archive.tar.gz
exec tar -tzf archive.tar.gz
cmp stdout golden/archive

-- golden/apply --
$HOME
$HOME\dir
$HOME\anotherdir
-- golden/archive --
otherdir/script.cmd
anotherdir/
dir/
dir/script.cmd
otherdir/
anotherdir/script.cmd
-- golden/dump --
{
  "anotherdir": {
    "type": "dir",
    "name": "anotherdir",
    "perm": 511
  },
  "anotherdir/script.cmd": {
    "type": "script",
    "name": "anotherdir/script.cmd",
    "contents": "@echo %cd%\n"
  },
  "dir": {
    "type": "dir",
    "name": "dir",
    "perm": 511
  },
  "dir/script.cmd": {
    "type": "script",
    "name": "dir/script.cmd",
    "contents": "@echo %cd%\n"
  },
  "otherdir": {
    "type": "dir",
    "name": "otherdir",
    "perm": 511
  },
  "otherdir/script.cmd": {
    "type": "script",
    "name": "otherdir/script.cmd",
    "contents": "@echo %cd%\n"
  }
}
-- home/user/.local/share/chezmoi/anotherdir/run_after_script.cmd --
@echo %cd%
-- home/user/.local/share/chezmoi/dir/run_script.cmd --
@echo %cd%
-- home/user/.local/share/chezmoi/otherdir/run_before_script.cmd --
@echo %cd%
