Skip to content

Commit 670c8d3

Browse files
committed
adding notes about changed and new method in File class for 2.1
1 parent 883e39e commit 670c8d3

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

en/core-utility-libraries/file-folder.rst

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ Basic usage
99
===========
1010

1111
Ensure the classes are loaded using :php:meth:`App::uses()`::
12-
12+
1313
<?php
1414
App::uses('Folder', 'Utility');
1515
App::uses('File', 'Utility');
1616

1717
Then we can setup a new folder instance::
18-
18+
1919
<?php
2020
$dir = new Folder('/path/to/folder');
2121

2222
and search for all *.ctp* files within that folder using regex::
23-
23+
2424
<?php
2525
$files = $dir->find('.*\.ctp');
2626

2727
Now we can loop through the files and read, write or append to the contents or
2828
simply delete the file::
29-
29+
3030
<?php
3131
foreach ($files as $file) {
3232
$file = new File($dir->pwd() . DS . $file);
@@ -50,7 +50,7 @@ Folder API
5050

5151
.. php:attr:: path
5252
53-
Current path to the folder. :php:meth:`Folder::pwd()` will return the same
53+
Current path to the folder. :php:meth:`Folder::pwd()` will return the same
5454
information.
5555

5656
.. php:attr:: sort
@@ -59,7 +59,7 @@ Folder API
5959

6060
.. php:attr:: mode
6161
62-
Mode to be used when creating folders. Defaults to ``0755``. Does nothing on
62+
Mode to be used when creating folders. Defaults to ``0755``. Does nothing on
6363
windows machines.
6464

6565
.. php:staticmethod:: addPathElement( $path, $element )
@@ -91,7 +91,7 @@ Folder API
9191
9292
:rtype: boolean
9393

94-
Change the mode on a directory structure recursively. This includes
94+
Change the mode on a directory structure recursively. This includes
9595
changing the mode on files as well::
9696

9797
<?php
@@ -103,7 +103,7 @@ Folder API
103103
104104
:rtype: boolean
105105

106-
Recursively copy a directory. The only parameter $options can either
106+
Recursively copy a directory. The only parameter $options can either
107107
be a path into copy to or an array of options::
108108

109109
<?php
@@ -124,15 +124,15 @@ Folder API
124124
125125
:rtype: string
126126

127-
Returns a correct set of slashes for given $path. (\\ for
127+
Returns a correct set of slashes for given $path. (\\ for
128128
Windows paths and / for other paths.)
129129

130130

131131
.. php:method:: create( $pathname, $mode = false )
132132
133133
:rtype: boolean
134134

135-
Create a directory structure recursively. Can be used to create
135+
Create a directory structure recursively. Can be used to create
136136
deep path structures like `/foo/bar/baz/shoe/horn`::
137137

138138
<?php
@@ -190,8 +190,8 @@ Folder API
190190

191191
.. note::
192192

193-
The folder find and findRecursive methods will only find files. If you
194-
would like to get folders and files see :php:meth:`Folder::read()` or
193+
The folder find and findRecursive methods will only find files. If you
194+
would like to get folders and files see :php:meth:`Folder::read()` or
195195
:php:meth:`Folder::tree()`
196196

197197

@@ -271,7 +271,7 @@ Folder API
271271
272272
:rtype: string
273273

274-
Returns a correct set of slashes for given $path. (\\ for
274+
Returns a correct set of slashes for given $path. (\\ for
275275
Windows paths and / for other paths.)
276276

277277

@@ -287,11 +287,11 @@ Folder API
287287
:rtype: mixed
288288

289289
:param boolean $sort: If true will sort results.
290-
:param mixed $exceptions: An array of files and folder names to ignore. If
290+
:param mixed $exceptions: An array of files and folder names to ignore. If
291291
true or '.' this method will ignore hidden or dot files.
292292
:param boolean $fullPath: If true will return results using absolute paths.
293293

294-
Returns an array of the contents of the current directory. The
294+
Returns an array of the contents of the current directory. The
295295
returned array holds two arrays: One of directories and one of files::
296296

297297
<?php
@@ -327,7 +327,7 @@ Folder API
327327
328328
:rtype: string
329329

330-
Returns $path with added terminating slash (corrected for
330+
Returns $path with added terminating slash (corrected for
331331
Windows or other OS).
332332

333333

@@ -355,7 +355,7 @@ File API
355355

356356
.. php:attr:: name
357357
358-
The name of the file with the extension. Differs from
358+
The name of the file with the extension. Differs from
359359
:php:meth:`File::name()` which returns the name without the extension.
360360

361361
.. php:attr:: info
@@ -398,7 +398,7 @@ File API
398398
.. php:method:: create( )
399399
400400
:rtype: boolean
401-
401+
402402
Creates the File.
403403

404404

@@ -450,6 +450,8 @@ File API
450450

451451
Returns the File info.
452452

453+
.. versionchanged:: 2.1
454+
``File::info()`` now includes filesize & mimetype information.
453455

454456
.. php:method:: lastAccess( )
455457
@@ -510,8 +512,8 @@ File API
510512
511513
:rtype: string
512514

513-
Prepares a ascii string for writing. Converts line endings to the
514-
correct terminator for the current platform. If windows "\r\n"
515+
Prepares a ascii string for writing. Converts line endings to the
516+
correct terminator for the current platform. If windows "\r\n"
515517
will be used all other platforms will use "\n"
516518

517519

@@ -563,6 +565,8 @@ File API
563565

564566
Write given data to this File.
565567

568+
.. versionadded:: 2.1 ``File::mime()``
569+
566570
.. php:method:: mime()
567571
568572
:rtype: mixed

0 commit comments

Comments
 (0)