Difference between revisions of "Blitz:Dos.include.ab3"

From Amiga Coding
Jump to: navigation, search
(Created page with "The dos.include.ab3 Include file contains some useful functions for handling paths, directories and general DOS-related tasks. ==Path Handling== ===dos_AddPart=== This functi...")
 
(Path Handling)
Line 17: Line 17:
 
<code>MyFile$ = dos_FilePart{"Workbench:System/Format"}</code>
 
<code>MyFile$ = dos_FilePart{"Workbench:System/Format"}</code>
 
Will return the string "Format".
 
Will return the string "Format".
 +
 +
===dos_GetProgDir===
 +
This function returns the full path to your program. This can be useful to determine the absolute path to any files or directories in your program's directory:
 +
<code>MyDir$ = dos_GetProgDir{"Projects:MyProgram"}</code>
 +
The string argument given is only used when the program is run directly from the editor.
  
 
==File Checking==
 
==File Checking==

Revision as of 14:30, 2 October 2015

The dos.include.ab3 Include file contains some useful functions for handling paths, directories and general DOS-related tasks.

Path Handling

dos_AddPart

This function adds the two given string arguments together and returns the result as an AmigaDOS-legal path. Very useful for adding a filename onto a directory name to produce the full path, but without having to worry about whether the path string ends in :, / or just the drawer name: fullpath$ = dos_AddPart{"Workbench:System", "Format"} fullpath2$ = dos_AddPart{"Workbench:System/", "Format"} Both examples above will return the string "Workbench:System/Format".

dos_PathPart

This function returns the part of the given string that constitutes the directory in which the target of the given path resides. Useful for getting the directory of a file: MyDirectory$ = dos_PathPart{"Workbench:System/Format"} Will return the path "Workbench:System".

dos_FilePart

Similar to dos_PathPart{} above, but returns the filename instead: MyFile$ = dos_FilePart{"Workbench:System/Format"} Will return the string "Format".

dos_GetProgDir

This function returns the full path to your program. This can be useful to determine the absolute path to any files or directories in your program's directory: MyDir$ = dos_GetProgDir{"Projects:MyProgram"} The string argument given is only used when the program is run directly from the editor.

File Checking

dos_Exist

This function checks if the given file exists, and returns True (-1) if it does or False (0) otherwise: result.l = dos_Exist{"Workbench:System/Format"} This should return True unless someone has moved the Format command on your system...