• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

/usr/lib/swipl/library/ext/clib/filesex.pl
All Application Manual Name SummaryHelp

  • ext
    • clib
      • socket.pl
      • uid.pl
      • unix.pl -- Unix specific operations
      • syslog.pl -- Unix syslog interface
      • filesex.pl -- Extended operations on files
        • set_time_file/3
        • link_file/3
        • relative_file_name/3
      • uri.pl -- Process URIs
      • process.pl -- Create processes and redirect I/O
      • time.pl -- Time and alarm library
      • sha.pl -- SHA secure hashes
      • crypt.pl
      • memfile.pl
      • uuid.pl -- Universally Unique Identifier (UUID) Library
      • hash_stream.pl -- Maintain a hash on a stream
      • md5.pl -- MD5 hashes
      • udp_broadcast.pl -- A UDP broadcast proxy
      • streampool.pl -- Input multiplexing
      • cgi.pl -- Read CGI parameters
      • prolog_stream.pl -- A stream with Prolog callbacks
      • rlimit.pl
 relative_file_name(+Path:atom, +RelToFile:atom, -RelPath:atom) is det
relative_file_name(-Path:atom, +RelToFile:atom, +RelPath:atom) is det
True when RelPath is Path, relative to the file RelToFile. Path and RelTo are first handed to absolute_file_name/2, which makes the absolute and canonical. Below are two examples:
?- relative_file_name('/home/janw/nice',
                      '/home/janw/deep/dir/file', Path).
Path = '../../nice'.

?- relative_file_name(Path, '/home/janw/deep/dir/file', '../../nice').
Path = '/home/janw/nice'.

Add a terminating / to get a path relative to a directory, e.g.

?- relative_file_name('/home/janw/deep/dir/file', './', Path).
Path = 'deep/dir/file'.
Arguments:
All- paths must be in canonical POSIX notation, i.e., using / to separate segments in the path. See prolog_to_os_filename/2.
bug
- It would probably have been cleaner to use a directory as second argument. We can not do such dynamically as this predicate is defined as a syntactical operation, which implies it may be used for non-existing paths and URLs.
ClioPatria (version V3.1.1-51-ga0b30a5)