File Utilities: Difference between revisions
No edit summary |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
File and directory management functions. | File and directory management functions. | ||
{|class="wikitable" | |||
{| | !Entity||Type||Scope||Short Description | ||
|- | |- | ||
|chdrivedir||function||public||Change current default drive and working directory. | |||
|- | |- | ||
| | |is_dir||function||public||Returns TRUE if the specified location is a directory. | ||
|function | |||
|public | |||
| | |||
|- | |- | ||
| | |is_file||function||public||Returns TRUE if the specified location is a regular file. | ||
|function | |||
|public | |||
| Returns TRUE if the specified location is a | |||
|- | |- | ||
| | |is_root||function||public||Returns TRUE if the specified location is a root directory. | ||
|function | |||
|public | |||
| Returns TRUE if the specified location is a | |||
|- | |- | ||
| | |is_url||function||public||Returns TRUE if the specified location is a URL. | ||
|function | |||
|public | |||
| Returns TRUE if the specified location is a | |||
|- | |- | ||
| | |scheme||function||public||Returns the scheme followed by a colon (:) of the specified location. | ||
|function | |||
|public | |||
| Returns | |||
|- | |- | ||
| | |sdecode||function||public||Passed any string value, decode from URL transmission. | ||
|function | |||
|public | |||
| | |||
|- | |- | ||
| | |sdrive||function||public||Returns the drive letter followed by a colon (:) if a drive is specified in the location. | ||
|function | |||
|public | |||
| | |||
|- | |- | ||
| | |sdrivedir||function||public||Returns the drive letter or scheme and the path of subdirectories, if any, including the trailing slash. | ||
|function | |||
|public | |||
| | |||
| Returns the drive letter or scheme and the path of subdirectories, if any, including the trailing slash. | |||
|- | |- | ||
|sfext | |sfext||function||public||Returns the file name extension, if any, including the leading period (.). | ||
|function | |||
|public | |||
| Returns the file name extension, if any, including the leading period (.). | |||
|- | |- | ||
|sfextrep | |sfextrep||function||public||Replaces an extension of the specified file. | ||
|function | |||
|public | |||
| Replaces an extension of the specified file. | |||
|- | |- | ||
|sfname | |sfname||function||public||Returns the base file name without any extensions. | ||
|function | |||
|public | |||
| Returns the base file name without any extensions. | |||
|- | |- | ||
|sfnameext | |sfnameext||function||public||Returns the base file name with file extension. | ||
|function | |||
|public | |||
| Returns the base file name with file extension. | |||
|- | |- | ||
|smakepath | |smakepath||function||public||Creates a single path name, composed of a base path name and file or directory name. | ||
|function | |||
|public | |||
| Creates a single path name, composed of a base path name and file or directory name. | |||
|} | |} | ||
Line 100: | Line 39: | ||
Returns a value of 0 if the default drive and working directory was successfully changed. A return value of -1 indicates an error. | Returns a value of 0 if the default drive and working directory was successfully changed. A return value of -1 indicates an error. | ||
; Source: pm_fileutils.h:195 | ;Source: pm_fileutils.h:195 | ||
;Author: Dmitry A.Steklenev | |||
; Author: | ;Version: 1.0 | ||
;Code: | |||
; Version: 1.0 | public int chdrivedir (const char * pathname) | ||
; Code: | |||
==function is_dir== | ==function is_dir== | ||
Returns TRUE if the specified location is a directory. | Returns TRUE if the specified location is a directory. | ||
; Source: pm_fileutils.h:169 | ;Source: pm_fileutils.h:169 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public BOOL is_dir ( const char * location ) | |||
==function is_file== | ==function is_file== | ||
Returns TRUE if the specified location is a regular file. | Returns TRUE if the specified location is a regular file. | ||
; Source: pm_fileutils.h:142 | ;Source: pm_fileutils.h:142 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public BOOL is_file ( const char * location ) | |||
==function is_root== | ==function is_root== | ||
Returns TRUE if the specified location is a root directory. | Returns TRUE if the specified location is a root directory. | ||
; Source: pm_fileutils.h:160 | ;Source: pm_fileutils.h:160 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public BOOL is_root ( const char * location ) | |||
==function is_url== | ==function is_url== | ||
Returns TRUE if the specified location is a URL. | Returns TRUE if the specified location is a URL. | ||
; Source: pm_fileutils.h:151 | ;Source: pm_fileutils.h:151 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public BOOL is_url ( const char * location ) | |||
==function scheme== | ==function scheme== | ||
Line 151: | Line 86: | ||
Returns an empty string if specified location does not contain definition of the url scheme. | Returns an empty string if specified location does not contain definition of the url scheme. | ||
;Note: Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result. | |||
; Source: | ;Source: pm_fileutils.h:54 | ||
; Author: | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public char * scheme ( char * result , | |||
const char * location , | |||
size_t size ) | |||
==function sdecode== | ==function sdecode== | ||
Passed any string value, decode from URL transmission. | Passed any string value, decode from URL transmission. | ||
;Note: Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result. | |||
; Source: pm_fileutils.h:133 | ;Source: pm_fileutils.h:133 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public char * sdecode (char * result , | |||
const char * location , | |||
size_t size ) | |||
==function sdrive== | ==function sdrive== | ||
Line 179: | Line 114: | ||
Returns an empty string if specified path does not contain definition of the drive. | Returns an empty string if specified path does not contain definition of the drive. | ||
;Note: Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result. | |||
; Source: pm_fileutils.h:38 | ;Source: pm_fileutils.h:38 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public char * sdrive ( char * result , | |||
const char * location , | |||
size_t size ) | |||
==function sdrivedir== | ==function sdrivedir== | ||
Line 196: | Line 131: | ||
Returns an empty string if specified location does not contain any path definition. | Returns an empty string if specified location does not contain any path definition. | ||
;Note: Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result. | |||
; Source: pm_fileutils.h:120 | ;Source: pm_fileutils.h:120 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
;Code: | |||
; Code: | public char * sdrivedir ( char * result , | ||
const char * location , | |||
size_t size ) | |||
==function sfext== | ==function sfext== | ||
Returns the file name extension, if any, including the leading period (.). | Returns the file name extension, if any, including the leading period (.). | ||
;Note: Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result. | |||
; Source: pm_fileutils.h:80 | ;Source: pm_fileutils.h:80 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public char * sfext ( char * result , | |||
const char * location , | |||
size_t size ) | |||
==function sfextrep== | ==function sfextrep== | ||
Line 225: | Line 159: | ||
The specified extension may include the leading period (.). | The specified extension may include the leading period (.). | ||
; Source: pm_fileutils.h:91 | ;Source: pm_fileutils.h:91 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public char * sfextrep ( char * filename , | |||
const char * ext , | |||
int size ) | |||
==function sfname== | ==function sfname== | ||
Returns the base file name without any extensions. | Returns the base file name without any extensions. | ||
;Note: Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result. | |||
; Code: | ;Source: pm_fileutils.h:67 | ||
;Author: Dmitry A.Steklenev | |||
;Version: 1.0 | |||
;Code: | |||
public char * sfname ( char * result , | |||
const char * location , | |||
size_t size ) | |||
==function sfnameext== | ==function sfnameext== | ||
Line 252: | Line 185: | ||
The specified extension must include the leading period (.). | The specified extension must include the leading period (.). | ||
; Source: pm_fileutils.h:102 | ;Source: pm_fileutils.h:102 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public char * sfnameext ( char * result , | |||
const char * location , | |||
size_t size ) | |||
==function smakepath== | ==function smakepath== | ||
Creates a single path name, composed of a base path name and file or directory name. | Creates a single path name, composed of a base path name and file or directory name. | ||
; Source: pm_fileutils.h:179 | ;Source: pm_fileutils.h:179 | ||
; Author: Dmitry A.Steklenev | ;Author: Dmitry A.Steklenev | ||
; Version: 1.0 | ;Version: 1.0 | ||
; Code: | ;Code: | ||
public char *smakepath (char *result, | |||
const char *pathname, | |||
const char *name, | |||
int size) | |||
[[Category:Glass PM C++ API]] | [[Category:Glass PM C++ API]] |
Latest revision as of 09:51, 16 May 2020
File and directory management functions.
Entity | Type | Scope | Short Description |
---|---|---|---|
chdrivedir | function | public | Change current default drive and working directory. |
is_dir | function | public | Returns TRUE if the specified location is a directory. |
is_file | function | public | Returns TRUE if the specified location is a regular file. |
is_root | function | public | Returns TRUE if the specified location is a root directory. |
is_url | function | public | Returns TRUE if the specified location is a URL. |
scheme | function | public | Returns the scheme followed by a colon (:) of the specified location. |
sdecode | function | public | Passed any string value, decode from URL transmission. |
sdrive | function | public | Returns the drive letter followed by a colon (:) if a drive is specified in the location. |
sdrivedir | function | public | Returns the drive letter or scheme and the path of subdirectories, if any, including the trailing slash. |
sfext | function | public | Returns the file name extension, if any, including the leading period (.). |
sfextrep | function | public | Replaces an extension of the specified file. |
sfname | function | public | Returns the base file name without any extensions. |
sfnameext | function | public | Returns the base file name with file extension. |
smakepath | function | public | Creates a single path name, composed of a base path name and file or directory name. |
function chdrivedir
Change current default drive and working directory.
Causes the current default drive and working directory to change to the directory specified by pathname. The pathname must refer to an existing directory.
Returns a value of 0 if the default drive and working directory was successfully changed. A return value of -1 indicates an error.
- Source
- pm_fileutils.h:195
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public int chdrivedir (const char * pathname)
function is_dir
Returns TRUE if the specified location is a directory.
- Source
- pm_fileutils.h:169
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public BOOL is_dir ( const char * location )
function is_file
Returns TRUE if the specified location is a regular file.
- Source
- pm_fileutils.h:142
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public BOOL is_file ( const char * location )
function is_root
Returns TRUE if the specified location is a root directory.
- Source
- pm_fileutils.h:160
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public BOOL is_root ( const char * location )
function is_url
Returns TRUE if the specified location is a URL.
- Source
- pm_fileutils.h:151
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public BOOL is_url ( const char * location )
function scheme
Returns the scheme followed by a colon (:) of the specified location.
Returns an empty string if specified location does not contain definition of the url scheme.
- Note
- Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result.
- Source
- pm_fileutils.h:54
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public char * scheme ( char * result , const char * location , size_t size )
function sdecode
Passed any string value, decode from URL transmission.
- Note
- Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result.
- Source
- pm_fileutils.h:133
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public char * sdecode (char * result , const char * location , size_t size )
function sdrive
Returns the drive letter followed by a colon (:) if a drive is specified in the location.
Returns an empty string if specified path does not contain definition of the drive.
- Note
- Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result.
- Source
- pm_fileutils.h:38
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public char * sdrive ( char * result , const char * location , size_t size )
function sdrivedir
Returns the drive letter or scheme and the path of subdirectories, if any, including the trailing slash.
Slashes (/), backslashes (\), or both may be present in location.
Returns an empty string if specified location does not contain any path definition.
- Note
- Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result.
- Source
- pm_fileutils.h:120
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public char * sdrivedir ( char * result , const char * location , size_t size )
function sfext
Returns the file name extension, if any, including the leading period (.).
- Note
- Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result.
- Source
- pm_fileutils.h:80
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public char * sfext ( char * result , const char * location , size_t size )
function sfextrep
Replaces an extension of the specified file.
The specified extension may include the leading period (.).
- Source
- pm_fileutils.h:91
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public char * sfextrep ( char * filename , const char * ext , int size )
function sfname
Returns the base file name without any extensions.
- Note
- Because the result string always less or is equal to a location string all functions can safely use the same storage area for a location and result.
- Source
- pm_fileutils.h:67
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public char * sfname ( char * result , const char * location , size_t size )
function sfnameext
Returns the base file name with file extension.
The specified extension must include the leading period (.).
- Source
- pm_fileutils.h:102
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public char * sfnameext ( char * result , const char * location , size_t size )
function smakepath
Creates a single path name, composed of a base path name and file or directory name.
- Source
- pm_fileutils.h:179
- Author
- Dmitry A.Steklenev
- Version
- 1.0
- Code
public char *smakepath (char *result, const char *pathname, const char *name, int size)