Overview
The Singleton is designed to facilitate the developer to manipulate the file path. Defined ascc.pathThe purpose is to follownodejsOfpathRemain consistent. The API defined inside is also basicallynodejsOfpathModules are consistent, but not all, and may continue to be added as needed in the future. It also adds a fewpathThe module does not have Pai, for examplecc.path.changeExtnameAndcc.path.changeBasename。
Cc.path.join
Path stitching operation.
Parameters:
| name |
type |
| Variable-length parameters |
String |
Cc.path.extname
Gets the suffix name of the file path.
Parameters:
Cc.path.basename
Gets the file name.
Parameters:
| name |
type |
Remark |
| Pathstr |
String |
Must fill in |
| Extname |
String |
Optional, specifies the name of the suffix to be removed from the file name, and does not consider removing the suffix name |
Cc.path.driname
Gets the folder path where the file resides.
Parameters:
| name |
type |
Remark |
| Pathstr |
String |
Required, File path |
Cc.path.changeExtname
Change the file suffix name.
Parameters:
| name |
type |
remark |
| Pathstr |
String |
Must fill in |
| Extname |
String |
Specifies the suffix name to be modified, not the suffix name |
Cc.path.changeBasename
Change the file name.
Parameters:
| name |
type |
Remark |
| Pathstr |
String |
Must fill in |
| BaseName |
String |
Specifies the suffix name to be modified, not the suffix name |
| Issameext |
Boolean |
Whether the same suffix name is guaranteed |
Example
See tests the PathTest test examples in.
Reprint Please specify: http://www.cocos2dx.net/post/200
"COCOS2D-JS official documents" Xi. Cc.path