KScript docs
EN

The language

Writing portable scripts

  • Build paths with @join_path(base: $dir, ['reports', 'file.txt']) (KScript.IO) rather than hard-coding \ or /.
  • Find the user's folders with @known_folder(downloads) (KScript.IO): home, desktop, documents, downloads, music, pictures, videos, appdata or temp. It follows each system's own settings, such as Windows' Downloads location and Linux's user-dirs.dirs.
  • $os.name is windows, linux or macos, and $os.home, $os.temp and $os.separator are there too; $env.HOME reads an environment variable.
  • Numbers are always parsed and printed with . as the decimal separator, whatever the machine's language.