module Scar::Util

Extended Modules

Defined in:

scar/util.cr

Instance Method Summary

Instance Method Detail

def dir=(dir : String) #

Sets the subdirectory to write files to

The given path is appended to the user directory:

  • On windows: %appdata%\<dir>\
  • On linux: ~/.local/share/<dir>/

It is recommended to set your own subfolder via this method before writing to or reading from any files to avoid conficts.


[View source]
def read_file(name : String) #

Reads filename in the specified directory as a String


[View source]
def read_file_bytes(name : String) #

Same as read_file but reads it as Bytes


[View source]
def write_file(name : String, content : String) #

Writes a String to given filename in the specified directory


[View source]
def write_file_bytes(name : String, content : Bytes) #

Same as write_file but content is Bytes


[View source]