Skip to content

Implementation of DIR/DIRECTORY command with output parity#1900

Merged
RobertvanderHulst merged 2 commits intodevfrom
feature/vfp-dir-command
Apr 6, 2026
Merged

Implementation of DIR/DIRECTORY command with output parity#1900
RobertvanderHulst merged 2 commits intodevfrom
feature/vfp-dir-command

Conversation

@Irwin1985
Copy link
Copy Markdown
Contributor

This PR implements the DIR and DIRECTORY commands.

Key Changes:

  • Preprocessor Strategy: After extensive testing with various #command rules, I determined that the VFP-style wildcards (ej: DIR *.dbf) caused parsing conflicts. I opted for a "Runtime Parsing" approach where the entire command line is passed as a string to __VfpDir(cCommand).
  • Variable Evaluation: Implemented [NeedAccessToLocals(TRUE)] in the runtime function. This allows the command to correctly evaluate local variables used in the TO FILE (cVar) clause via Evaluate().
  • Output Fidelity: The output now matches VFP format.
    • Detailed DBF view: Displays non-DBF files in the classic columnar format.
    • Summary info: Displays total bytes, file count, and available disk space.
  • Support for clauses: Correctly handles LIKE, ON <drive>, TO FILE, and TO PRINTER.

@RobertvanderHulst
Copy link
Copy Markdown
Member

Irwin,
Do you expect the variable evaluation to update local variables? If not, then you should set the parameter of the NeedAccessToLocals attribute to FALSE.

@Irwin1985
Copy link
Copy Markdown
Contributor Author

You're right Robert. My bad. I just need to reading access.

@RobertvanderHulst RobertvanderHulst merged commit f6b2776 into dev Apr 6, 2026
1 check passed
@RobertvanderHulst RobertvanderHulst deleted the feature/vfp-dir-command branch April 7, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants