Namespace: OpenEdge.Core
Type: Class FileInfo
Parent Classes:
Progress.Lang.Object

Inherits: Progress.Lang.Object


/* *************************************************************************************************************************
Copyright (c) 2022 by Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.
File:FileInfo
Purpose:An abstract path - represents a file or a folder
Author(s):pjudge
Created:2022-01-31
Notes:* The FILE-INFO system handle is used to determine various attributes
about this path.



Method Summary
  Options Name Purpose
  CHARACTER AbsolutePath () /** Returns the absolute path. If the path does not exist on this host, or the file on this host is not the correct type, the unknown value is returned. @return character An absolute (file system) representation of this path */
  INTEGER CompareTo (FileInfo) /* Comparison method, used by SortedSet's default comparer FileInfo is inherited by OpenEdge.Core.File and OpenEdge.Core.Folder, so both object types can be passed using FileInfo. - If the returned value is less than 0 (zero), then the current object sorts before the object passed in. - If the returned value equals 0 (zero) , then the current object occupies the same position in the sort order. - If the returned value is greater than 0(zero), then the current object sorts after the object passed in. - If either object's Value is the unknown value (?), then that sorts high/early/before @param FileInfo The object to compare to (Can be type File or Folder). @return integer 0 = same object +1 = sorts after -1 = sorts before */
  LOGICAL Create () /* Creates the path on disk. Note that no error is thrown from this method; FALSE is returned instead. @return logical TRUE if the file was created. FALSE if the file already exists, or if an error wa raised during creation. */
  LOGICAL Delete () /* Deletes the path on disk. Note that no error is thrown from this method; FALSE is returned instead. @return logical TRUE if the path was deleted. FALSE if the path does not exist, or does not have write permissions, or if an error was raised during creation. */
  LOGICAL Equals (Object)
  CHARACTER GetShortName () /* Returns the Windows short name for this path. The absolute - resolved - path is returned. Backslashes are converted to / for the path separator @return character The short path. On non-Windows, or if an error is encountered, the absolute path is returned. */
  LOGICAL HasAttribute (character) /* Indicates whether the path has certain characteristics, as per FILE-TYPE attributes. See https://docs.progress.com/bundle/abl-reference/page/FILE-TYPE-attribute.html for details. The FILE-INFO handle must be set before calling this method; this is typically done using SetFileInfo(). @param character An attribute value - a single character from the documented values @return logical TRUE if the path exists on disk, AND is of the correct type (D or F) AND has the input attribute. FALSE otherwise */
  LOGICAL HasLegalName () /* Returns a flag indicating whether the path is legal for the current OS. @return logical TRUE if the path Name contains no illegal characters for the current platform, FALSE otherwise */
  SetFileInfo () /* Sets the FILE-INFO value to represent this path */
  LOGICAL StringContainsIllegalCharacters (character) /* Indicates whether a string has illegal characters anywhere in it. @param character A string to check @return logical TRUE if the string is not-null, and has at least one illegal character in it; FALSE otherwise */
  CHARACTER ToString ()

Constructor Summary
  Options Name Purpose
  FileInfo (character, character) /* Constructor @param character A path - not null. Cannot contain any of the following characters: <>:"|?* @param character The file-info type: D or F typically */
  FileInfo (character, character, character) /* Constructor. Sanitises the path - ie replaces illegal characters with the input replacement char(s). @param character A path - not null, not ".." Paths may start with "." or ".." @param character A/the replacement character that will replace the illegal characters. If ? is passed, no replacements are done, and the path name cannot contain any of the following characters: <>:"|?* */

Property Summary
  Options Name Purpose
  CHARACTER Basename
  LOGICAL CanCreate
  LOGICAL CanRead
  LOGICAL CanWrite
  DATETIME-TZ CreatedAt
  LOGICAL Exists
  LOGICAL IsRelativePath
  DATETIME-TZ LastUpdatedAt
  CHARACTER Name


Method Detail
Top

CHARACTER AbsolutePath ()

Purpose: Returns the absolute path. If the path does not exist on this host, or the file on this host is not
the correct type, the unknown value is returned.
Returns CHARACTER
  character An absolute (file system) representation of this path
Top

INTEGER CompareTo (FileInfo)

/* Comparison method, used by SortedSet's default comparer
FileInfo is inherited by OpenEdge.Core.File and OpenEdge.Core.Folder, so both object types can be
passed using FileInfo.
- If the returned value is less than 0 (zero), then the current object sorts before the object passed in.
- If the returned value equals 0 (zero) , then the current object occupies the same position in the sort order.
- If the returned value is greater than 0(zero), then the current object sorts after the object passed in.
- If either object's Value is the unknown value (?), then that sorts high/early/before
+1 = sorts after
-1 = sorts before
Parameters:
pOther OpenEdge.Core.FileInfo
 
Returns INTEGER
  integer 0 = same object
Top

LOGICAL Create ()

/* Creates the path on disk.
Note that no error is thrown from this method; FALSE is returned instead.
Returns LOGICAL
  logical TRUE if the file was created. FALSE if the file already exists, or if an error wa raised during creation.
Top

LOGICAL Delete ()

/* Deletes the path on disk.
Note that no error is thrown from this method; FALSE is returned instead.
or if an error was raised during creation.
Returns LOGICAL
  logical TRUE if the path was deleted. FALSE if the path does not exist, or does not have write permissions,
Top

LOGICAL Equals (Object)

Parameters:
pRef Progress.Lang.Object
 
Returns LOGICAL
 
Top

CHARACTER GetShortName ()

/* Returns the Windows short name for this path. The absolute - resolved - path is returned. Backslashes are converted
to / for the path separator
Returns CHARACTER
  character The short path. On non-Windows, or if an error is encountered, the absolute path is returned.
Top

LOGICAL HasAttribute (character)

/* Indicates whether the path has certain characteristics, as per FILE-TYPE
attributes. See https://docs.progress.com/bundle/abl-reference/page/FILE-TYPE-attribute.html for
details.
The FILE-INFO handle must be set before calling this method; this is typically done using SetFileInfo().
Parameters:
pAttribute CHARACTER
 
Returns LOGICAL
  logical TRUE if the path exists on disk, AND is of the correct type (D or F) AND has the input attribute. FALSE otherwise
Top

LOGICAL HasLegalName ()

/* Returns a flag indicating whether the path is legal for the current OS.
Returns LOGICAL
  logical TRUE if the path Name contains no illegal characters for the current platform, FALSE otherwise
Top

SetFileInfo ()

/* Sets the FILE-INFO value to represent this path
Top

LOGICAL StringContainsIllegalCharacters (character)

/* Indicates whether a string has illegal characters anywhere in it.
Parameters:
pValue CHARACTER
 
Returns LOGICAL
  logical TRUE if the string is not-null, and has at least one illegal character in it; FALSE otherwise
Top

CHARACTER ToString ()

Returns CHARACTER
 


Constructor Detail
Top

FileInfo (character, character)

/* Constructor
Parameters:
pPath CHARACTER
 
pType CHARACTER
 
Top

FileInfo (character, character, character)

/* Constructor. Sanitises the path - ie replaces illegal characters with the input replacement char(s).
are done, and the path name cannot contain any of the following characters: <>:"|?*
Parameters:
pPath CHARACTER
 
pType CHARACTER
 
pReplacementChar CHARACTER
 


Property Detail
Top

CHARACTER Basename

Returns CHARACTER
 
Top

LOGICAL CanCreate

Returns LOGICAL
 
Top

LOGICAL CanRead

Returns LOGICAL
 
Top

LOGICAL CanWrite

Returns LOGICAL
 
Top

DATETIME-TZ CreatedAt

Returns DATETIME-TZ
 
Top

LOGICAL Exists

Returns LOGICAL
 
Top

LOGICAL IsRelativePath

Returns LOGICAL
 
Top

DATETIME-TZ LastUpdatedAt

Returns DATETIME-TZ
 
Top

CHARACTER Name

Returns CHARACTER