Product SiteDocumentation Site

5.4.25.14. init


>>-init(path-+------+-)----------------------------------------><
             +-,dir-+

Initializes a new File instance with the path path (after normalization).
If specified, dir is a parent path that is prepended to path. If dir is a File object then the absolute path of dir is prepended, otherwise dir is prepended as-is (after normalization). The normalization consists in adjusting the separators to the platform's convention and removing the final separator (if any).

Example 5.207. Class FILE - init method


/* Windows */
file = .File~new("file")                     -- file
file = .File~new("c:\program files\")        -- c:\program files
file = .File~new("file", "c:/program files") -- c:\program files\file
'cd c:\program files\oorexx'
samples = .File~new("samples")               -- samples
file = .File~new("file", "samples")          -- samples\file
file = .File~new("file", samples)            -- c:\program files\oorexx\samples\file

/* Unix */
file = .File~new("/opt/ooRexx/")             -- /opt/ooRexx
'cd /opt/ooRexx'
samples = .File~new("samples")               -- samples
file = .File~new("file", "samples")          -- samples/file
file = .File~new("file", samples)            -- /opt/ooRexx/samples/file