GithubHelp home page GithubHelp logo

mbaas2 / filesanddirs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aplteam/filesanddirs

0.0 2.0 0.0 3.35 MB

Functions for dealing with files and directories

License: MIT License

Batchfile 0.01% APL 99.99%

filesanddirs's Introduction

Dealing with Files and Directories

FileAndDirs is a member of the APLTree library. The library is a collection of classes etc. that aim to support the Dyalog APL programmer. Search GitHub for "apltree" and you will find solutions to many every-day problems Dyalog APL programmers might have to solve.

Overview

With version 15.0 Dyalog has introduced several new system functions that make it much easier to write platform independent code when it comes to dealing with files and directories.

However, there are some gaps left: copying and moving files for example, or a recursive directory listing.

FilesAndDirs aims to close these gaps: it offers the same functionality for Windows, Linux and Mac OS.

Slashes and backslashes

Under Windows the backslash \ character is used as delimiter. Under Linux and Mac OS it is the / character. However, Windows is willing to accept the / rather than the \ in most cases. The easiest way therefore seems to be to use / everywhere.

Almost. As it turns out there are several occasions when one still has to settle for the \:

  • Calls to third party software.
  • Calls to .NET assemblies.
  • Setting properties like Directory in the FileBox GUI objects.
  • ... (there are most likely more!)

For that reason since version 1.3 all methods of FilesAndDirs accept both the / and the \ characters as directory seperators but when returning a result that is a path name then it will always make sure that the correct separator for the given operating system is used.

That's the reason why the class offers method like Exists, CreateFile, DeleteFile and even NNAMES and NCREATE: they don't do much more than their system function equivalents except that they normalize any filenames and directory names.

Of course this means that FilesAndDirs cannot deal under Linux and Mac OS with names that contain a \, but if you try to write platform independent code then you must not do this anyway, and most likely you shouldn't even if you don't.

Methods

  Cd
  CheckPath
  CopyTo
  CopyTree
  CreateFile
  CurrentSep
  DeleteFile
  Dir
  EnforceBackslash
  EnforceSlash
  Exists
  GetNewLineCharsFor
  GetTempFilename
  GetTempPath
  IsDir
  IsFile
  IsSymbolicLink
  ListDirs
  ListFiles
  MkDir
  MoveTo
  MoveTree
  NCREATE
  NNAMES
  NormalizePath
  PolishCurrentDir
  PWD
  RmDir
  Version

FilesAndDirs needs version 15.0 Unicode of Dyalog APL, or better.

filesanddirs's People

Contributors

aplteam avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.