From 9b6e4b92fcf0368b78d2328beb3bec8cc9d2f0c8 Mon Sep 17 00:00:00 2001 From: Jack Thorne Date: Sun, 10 Sep 2023 00:08:23 -0500 Subject: [PATCH] Dir Docs #mkdir #exists? - Add docs for Dir.mkdir - Add docs for Dir.exists? --- src/dir.cr | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/dir.cr b/src/dir.cr index 2b6bfd13c7a9..121a77172789 100644 --- a/src/dir.cr +++ b/src/dir.cr @@ -246,6 +246,11 @@ class Dir end # Returns `true` if the given path exists and is a directory + # + # ``` + # Dir.mkdir("testdir") + # Dir.exists?("testdir") # => true + # ``` def self.exists?(path : Path | String) : Bool if info = File.info?(path) info.type.directory? @@ -274,6 +279,11 @@ class Dir # can be specified, with a default of 777 (0o777). # # NOTE: *mode* is ignored on windows. + # + # ``` + # Dir.mkdir("testdir") + # Dir.exists?("testdir") # => true + # ``` def self.mkdir(path : Path | String, mode = 0o777) : Nil Crystal::System::Dir.create(path.to_s, mode) end