fileSystem_ScriptBinding.cc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "platform/platform.h"
  23. #include "console/console.h"
  24. #include "console/consoleInternal.h"
  25. #include "console/ast.h"
  26. #include "io/resource/resourceManager.h"
  27. #include "io/fileStream.h"
  28. #include "console/compiler.h"
  29. #include "platform/event.h"
  30. #include "game/gameInterface.h"
  31. #include "platform/platformInput.h"
  32. #include "torqueConfig.h"
  33. #include "memory/frameAllocator.h"
  34. // Buffer for expanding script filenames.
  35. static char scriptFilenameBuffer[1024];
  36. //-------------------------------------- Helper Functions
  37. static void forwardslash(char *str)
  38. {
  39. while(*str)
  40. {
  41. if(*str == '\\')
  42. *str = '/';
  43. str++;
  44. }
  45. }
  46. static void backslash(char *str)
  47. {
  48. while(*str)
  49. {
  50. if(*str == '/')
  51. *str = '\\';
  52. str++;
  53. }
  54. }
  55. //----------------------------------------------------------------
  56. static ResourceObject *firstMatch = NULL;
  57. ConsoleFunctionGroupBegin( FileSystem, "Functions allowing you to search for files, read them, write them, and access their properties.");
  58. /*! @addtogroup FileSystem File System
  59. @ingroup TorqueScriptFunctions
  60. @{
  61. */
  62. /*!
  63. @param strPattern The string pattern to search for.
  64. @return Returns a string representing the first file in the directory system matching the given pattern.
  65. */
  66. ConsoleFunctionWithDocs(findFirstFile, ConsoleString, 2, 2, ( strPattern ))
  67. {
  68. TORQUE_UNUSED( argc );
  69. const char *fn = NULL;
  70. firstMatch = NULL;
  71. if(Con::expandPath(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[1]))
  72. firstMatch = ResourceManager->findMatch(scriptFilenameBuffer, &fn, NULL);
  73. if(firstMatch)
  74. return fn;
  75. else
  76. return "";
  77. }
  78. /*!
  79. @param strPattern The string pattern to search for.
  80. @return Returns the next file matching a search begun in findFirstFile.
  81. */
  82. ConsoleFunctionWithDocs(findNextFile, ConsoleString, 2, 2, ( strPattern ))
  83. {
  84. TORQUE_UNUSED( argc );
  85. const char *fn = NULL;
  86. if(Con::expandPath(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[1]))
  87. firstMatch = ResourceManager->findMatch(scriptFilenameBuffer, &fn, firstMatch);
  88. else
  89. firstMatch = NULL;
  90. if(firstMatch)
  91. return fn;
  92. else
  93. return "";
  94. }
  95. /*!
  96. @param strPattern The string pattern to search for.
  97. @return Returns the number of files in the directory tree that match the given pattern
  98. */
  99. ConsoleFunctionWithDocs(getFileCount, ConsoleInt, 2, 2, (strPattern))
  100. {
  101. TORQUE_UNUSED( argc );
  102. const char* fn;
  103. U32 count = 0;
  104. firstMatch = ResourceManager->findMatch(argv[1], &fn, NULL);
  105. if ( firstMatch )
  106. {
  107. count++;
  108. while ( 1 )
  109. {
  110. firstMatch = ResourceManager->findMatch(argv[1], &fn, firstMatch);
  111. if ( firstMatch )
  112. count++;
  113. else
  114. break;
  115. }
  116. }
  117. return( count );
  118. }
  119. /*!
  120. @param strPattern The string pattern to search for.
  121. @return Returns the first file in the directory system matching the given pattern.
  122. */
  123. ConsoleFunctionWithDocs(findFirstFileMultiExpr, ConsoleString, 2, 2, (strPattern))
  124. {
  125. TORQUE_UNUSED( argc );
  126. const char *fn = NULL;
  127. firstMatch = NULL;
  128. if(Con::expandPath(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[1]))
  129. firstMatch = ResourceManager->findMatchMultiExprs(scriptFilenameBuffer, &fn, NULL);
  130. if(firstMatch)
  131. return fn;
  132. else
  133. return "";
  134. }
  135. /*! Returns the next file matching a search begun in findFirstFile.
  136. */
  137. ConsoleFunctionWithDocs(findNextFileMultiExpr, ConsoleString, 2, 2, (string pattern))
  138. {
  139. TORQUE_UNUSED( argc );
  140. const char *fn = NULL;
  141. if(Con::expandPath(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[1]))
  142. firstMatch = ResourceManager->findMatchMultiExprs(scriptFilenameBuffer, &fn, firstMatch);
  143. else
  144. firstMatch = NULL;
  145. if(firstMatch)
  146. return fn;
  147. else
  148. return "";
  149. }
  150. /*!
  151. @param strPattern The string pattern to search for.
  152. @return Returns the number of files in the directory tree that match the given pattern
  153. */
  154. ConsoleFunctionWithDocs(getFileCountMultiExpr, ConsoleInt, 2, 2, (strPattern))
  155. {
  156. TORQUE_UNUSED( argc );
  157. const char* fn;
  158. U32 count = 0;
  159. firstMatch = ResourceManager->findMatchMultiExprs(argv[1], &fn, NULL);
  160. if ( firstMatch )
  161. {
  162. count++;
  163. while ( 1 )
  164. {
  165. firstMatch = ResourceManager->findMatchMultiExprs(argv[1], &fn, firstMatch);
  166. if ( firstMatch )
  167. count++;
  168. else
  169. break;
  170. }
  171. }
  172. return( count );
  173. }
  174. /*!
  175. @param filename The string representing the file from which to get the CRC
  176. @return An integer
  177. */
  178. ConsoleFunctionWithDocs(getFileCRC, ConsoleInt, 2, 2, (filename))
  179. {
  180. TORQUE_UNUSED( argc );
  181. U32 crcVal;
  182. Con::expandPath(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[1]);
  183. if(!ResourceManager->getCrc(scriptFilenameBuffer, crcVal))
  184. return(-1);
  185. return(S32(crcVal));
  186. }
  187. /*! @param pathName Path to check. @return Returns true if the given path is a folder/directory, false otherwise
  188. */
  189. ConsoleFunctionWithDocs(isDirectory, ConsoleBool, 2, 2, (path))
  190. {
  191. bool doesExist = Platform::isDirectory(argv[1]);
  192. if(doesExist)
  193. return true;
  194. return false;
  195. }
  196. /*!
  197. @param fileName Filename to check.
  198. @return Returns true if the given filename is an existing file or false otherwise
  199. */
  200. ConsoleFunctionWithDocs(isFile, ConsoleBool, 2, 2, (fileName))
  201. {
  202. Con::expandPath(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[1]);
  203. return bool(ResourceManager->find(scriptFilenameBuffer));
  204. }
  205. /*!
  206. @param fileName Filename to check.
  207. @return Returns true if the given filename is an existing file and is not Read-Only or false otherwise
  208. */
  209. ConsoleFunctionWithDocs(isWriteableFileName, ConsoleBool, 2, 2, (fileName))
  210. {
  211. TORQUE_UNUSED( argc );
  212. char filename[1024];
  213. Con::expandPath(filename, sizeof(filename), argv[1]);
  214. if (filename == NULL || *filename == 0)
  215. return false;
  216. // in a writeable directory?
  217. if(!ResourceManager->isValidWriteFileName(filename))
  218. return(false);
  219. // exists?
  220. FileStream fs;
  221. if(!fs.open(filename, FileStream::Read))
  222. return(true);
  223. // writeable? (ReadWrite will create file if it does not exist)
  224. fs.close();
  225. if(!fs.open(filename, FileStream::ReadWrite))
  226. return(false);
  227. return(true);
  228. }
  229. /*!
  230. @param strPath The path in which to check
  231. @param intDepth The depth in which to return (default 0 if not specified)
  232. @return The directory contents
  233. */
  234. ConsoleFunctionWithDocs(getDirectoryList, ConsoleString, 2, 3, (strPath, [intDepth]?))
  235. {
  236. // Grab the full path.
  237. char path[1024];
  238. Platform::makeFullPathName(dStrcmp(argv[1], "/") == 0 ? "" : argv[1], path, sizeof(path));
  239. // Append a trailing backslash if it's not present already.
  240. if (path[dStrlen(path) - 1] != '/')
  241. {
  242. S32 pos = dStrlen(path);
  243. path[pos] = '/';
  244. path[pos + 1] = '\0';
  245. }
  246. // Grab the depth to search.
  247. S32 depth = 0;
  248. if (argc > 2)
  249. depth = dAtoi(argv[2]);
  250. // Dump the directories.
  251. Vector<StringTableEntry> directories;
  252. Platform::dumpDirectories(path, directories, depth, true);
  253. if( directories.empty() )
  254. return "";
  255. // Grab the required buffer length.
  256. S32 length = 0;
  257. for (S32 i = 0; i < directories.size(); i++)
  258. length += dStrlen(directories[i]) + 1;
  259. // Get a return buffer.
  260. char* buffer = Con::getReturnBuffer(length);
  261. char* p = buffer;
  262. // Copy the directory names to the buffer.
  263. for (S32 i = 0; i < directories.size(); i++)
  264. {
  265. dStrcpy(p, directories[i]);
  266. p += dStrlen(directories[i]);
  267. // Tab separated.
  268. p[0] = '\t';
  269. p++;
  270. }
  271. p--;
  272. p[0] = '\0';
  273. return buffer;
  274. }
  275. /*! Gets all the files in the specified directory.
  276. @param strPath The path in which to check
  277. @return A list of files in the specified directory.
  278. */
  279. ConsoleFunctionWithDocs(getFileList, ConsoleString, 2, 2, (strPath))
  280. {
  281. // Grab the full path.
  282. char basePath[1024];
  283. Con::expandPath( basePath, sizeof(basePath), argv[1] );
  284. Vector<Platform::FileInfo> files;
  285. if ( !Platform::dumpPath( basePath, files, 0 ) )
  286. {
  287. Con::warnf("Failed to get file list in directory '%s'", basePath );
  288. return "";
  289. }
  290. if ( files.size() == 0 )
  291. return "";
  292. // Grab the required buffer length.
  293. S32 length = 0;
  294. for (S32 i = 0; i < files.size(); i++)
  295. length += dStrlen(files[i].pFileName) + 1;
  296. // Get a return buffer.
  297. char* buffer = Con::getReturnBuffer(length);
  298. char* p = buffer;
  299. // Copy the directory names to the buffer.
  300. for (S32 i = 0; i < files.size(); i++)
  301. {
  302. dStrcpy(p, files[i].pFileName);
  303. p += dStrlen(files[i].pFileName);
  304. // Tab separated.
  305. p[0] = '\t';
  306. p++;
  307. }
  308. p--;
  309. p[0] = '\0';
  310. return buffer;
  311. }
  312. /*!
  313. @param fileName The name of the file to check.
  314. @return Returns the size of the file as an integer or -1 if file not found
  315. */
  316. ConsoleFunctionWithDocs(fileSize, ConsoleInt, 2, 2, (fileName))
  317. {
  318. TORQUE_UNUSED( argc );
  319. Con::expandPath(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[1]);
  320. return Platform::getFileSize( scriptFilenameBuffer );
  321. }
  322. /*!
  323. @param fileName Name of the file to remove
  324. @return Returns true on success and false on failure
  325. */
  326. ConsoleFunctionWithDocs(fileDelete, ConsoleBool, 2,2, (fileName))
  327. {
  328. static char fileName[1024];
  329. static char sandboxFileName[1024];
  330. Con::expandPath( fileName, sizeof( fileName ), argv[1] );
  331. Platform::makeFullPathName(fileName, sandboxFileName, sizeof(sandboxFileName));
  332. return Platform::fileDelete(sandboxFileName);
  333. }
  334. /*!
  335. @param directoryName Name of the directory to remove
  336. @return Returns true on success and false on failure
  337. */
  338. ConsoleFunctionWithDocs(directoryDelete, ConsoleBool, 2,2, (directoryName))
  339. {
  340. static char directoryName[1024];
  341. static char sandboxdirectoryName[1024];
  342. Con::expandPath( directoryName, sizeof( directoryName ), argv[1] );
  343. Platform::makeFullPathName(directoryName, sandboxdirectoryName, sizeof(sandboxdirectoryName));
  344. return Platform::deleteDirectory(sandboxdirectoryName);
  345. }
  346. //----------------------------------------------------------------
  347. /*!
  348. @param filePath Full path of file to check.
  349. @return Returns true if the given filename is a valid image file or false otherwise
  350. */
  351. ConsoleFunctionWithDocs(isValidImageFile, ConsoleBool, 2, 2, (string filePath))
  352. {
  353. Con::expandPath(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[1]);
  354. // does file exist?
  355. if (!ResourceManager->find(scriptFilenameBuffer))
  356. return false;
  357. const char *ext = dStrrchr(argv[1], '.');
  358. if (!ext)
  359. return false; // no extension
  360. Stream *stream = ResourceManager->openStream(scriptFilenameBuffer);
  361. if(stream == NULL)
  362. return false;
  363. bool ret = false;
  364. if (dStricmp(ext, ".jpg") == 0)
  365. {
  366. U8 bArray[2];
  367. stream->read(2, bArray);
  368. // check header signature
  369. ret = ((bArray[0] == 0xFF) && (bArray[1] == 0xD8));
  370. }
  371. else if (dStricmp(ext, ".png") == 0)
  372. {
  373. int i = 0;
  374. U8 bArray[8];
  375. stream->read(8, bArray);
  376. // check header signature
  377. ret = ((bArray[i++] == 0x89) && (bArray[i++] == 0x50) && (bArray[i++] == 0x4E) && (bArray[i++] == 0x47));
  378. }
  379. ResourceManager->closeStream(stream);
  380. return ret;
  381. }
  382. /*!
  383. @param Name of file from which to extract extension
  384. @return A string containing the file's extension (assuming all data after first '.' is the extension) or returns empty string on failure
  385. */
  386. ConsoleFunctionWithDocs(fileExt, ConsoleString, 2, 2, (fileName))
  387. {
  388. TORQUE_UNUSED( argc );
  389. const char *ret = dStrrchr(argv[1], '.');
  390. if(ret)
  391. return ret;
  392. return "";
  393. }
  394. /*!
  395. */
  396. ConsoleFunctionWithDocs(fileBase, ConsoleString, 2, 2, (fileName))
  397. {
  398. S32 pathLen = dStrlen( argv[1] );
  399. FrameTemp<char> szPathCopy( pathLen + 1);
  400. dStrcpy( szPathCopy, argv[1] );
  401. forwardslash( szPathCopy );
  402. TORQUE_UNUSED( argc );
  403. const char *path = dStrrchr(szPathCopy, '/');
  404. if(!path)
  405. path = szPathCopy;
  406. else
  407. path++;
  408. char *ret = Con::getReturnBuffer(dStrlen(path) + 1);
  409. dStrcpy(ret, path);
  410. char *ext = dStrrchr(ret, '.');
  411. if(ext)
  412. *ext = 0;
  413. return ret;
  414. }
  415. /*! Extract the filename from the full path description
  416. */
  417. ConsoleFunctionWithDocs(fileName, ConsoleString, 2, 2, (filePathName))
  418. {
  419. S32 pathLen = dStrlen( argv[1] );
  420. FrameTemp<char> szPathCopy( pathLen + 1);
  421. dStrcpy( szPathCopy, argv[1] );
  422. forwardslash( szPathCopy );
  423. TORQUE_UNUSED( argc );
  424. const char *name = dStrrchr(szPathCopy, '/');
  425. if(!name)
  426. name = szPathCopy;
  427. else
  428. name++;
  429. char *ret = Con::getReturnBuffer(dStrlen(name));
  430. dStrcpy(ret, name);
  431. return ret;
  432. }
  433. /*! Extract the file path from a file's full desciption
  434. */
  435. ConsoleFunctionWithDocs(filePath, ConsoleString, 2, 2, (fileName))
  436. {
  437. S32 pathLen = dStrlen( argv[1] );
  438. FrameTemp<char> szPathCopy( pathLen + 1);
  439. dStrcpy( szPathCopy, argv[1] );
  440. forwardslash( szPathCopy );
  441. TORQUE_UNUSED( argc );
  442. const char *path = dStrrchr(szPathCopy, '/');
  443. if(!path)
  444. return "";
  445. U32 len = path - (char*)szPathCopy;
  446. char *ret = Con::getReturnBuffer(len + 1);
  447. dStrncpy(ret, szPathCopy, len);
  448. ret[len] = 0;
  449. return ret;
  450. }
  451. /*! Gets the current date and time.
  452. @param reverse Determines if the format will be Month/Day/Year/Hour:Min:Seconds or Year/Month/Day/Hour:Min:Seconds
  453. */
  454. ConsoleFunctionWithDocs(getCurrentDate, ConsoleString, 2, 2, (bool reverse))
  455. {
  456. Platform::LocalTime lt;
  457. Platform::getLocalTime(lt);
  458. char temp[128];
  459. if (dAtob(argv[1]))
  460. dSprintf(temp, 256, "%d/%d/%d:%d:%d:%d", lt.year+1900, lt.month+1, lt.monthday, lt.hour, lt.min, lt.sec);
  461. else
  462. dSprintf(temp, 256, "%d/%d/%d:%d:%d:%d", lt.month+1, lt.monthday, lt.year+1900, lt.hour, lt.min, lt.sec);
  463. char* returnBuffer = Con::getReturnBuffer(dStrlen(temp + 1));
  464. dStrcpy(returnBuffer, temp);
  465. return returnBuffer;
  466. }
  467. /*! ;
  468. */
  469. ConsoleFunctionWithDocs(openFolder, ConsoleVoid, 2 ,2, (path))
  470. {
  471. Platform::openFolder( argv[1] );
  472. }
  473. /*!
  474. */
  475. ConsoleFunctionWithDocs(pathCopy, ConsoleBool, 3, 4, (fromFile, toFile, [nooverwrite = true]?))
  476. {
  477. bool nooverwrite = true;
  478. if( argc > 3 )
  479. nooverwrite = dAtob( argv[3] );
  480. static char fromFile[1024];
  481. static char toFile[1024];
  482. static char qualifiedFromFile[1024];
  483. static char qualifiedToFile[1024];
  484. Con::expandPath( fromFile, sizeof( fromFile ), argv[1] );
  485. Con::expandPath( toFile, sizeof( toFile ), argv[2] );
  486. Platform::makeFullPathName(fromFile, qualifiedFromFile, sizeof(qualifiedFromFile));
  487. Platform::makeFullPathName(toFile, qualifiedToFile, sizeof(qualifiedToFile));
  488. return Platform::pathCopy( qualifiedFromFile, qualifiedToFile, nooverwrite );
  489. }
  490. /*!
  491. */
  492. ConsoleFunctionWithDocs(getCurrentDirectory, ConsoleString, 1, 1, ())
  493. {
  494. return Platform::getCurrentDirectory();
  495. }
  496. /*!
  497. */
  498. ConsoleFunctionWithDocs( setCurrentDirectory, ConsoleBool, 2, 2, (absolutePathName))
  499. {
  500. return Platform::setCurrentDirectory( StringTable->insert( argv[1] ) );
  501. }
  502. /*!
  503. */
  504. ConsoleFunctionWithDocs(getExecutableName, ConsoleString, 1, 1, ())
  505. {
  506. return Platform::getExecutableName();
  507. }
  508. /*!
  509. */
  510. ConsoleFunctionWithDocs(getMainDotCsDir, ConsoleString, 1, 1, ())
  511. {
  512. return Platform::getMainDotCsDir();
  513. }
  514. /*!
  515. */
  516. ConsoleFunctionWithDocs(makeFullPath, ConsoleString, 2, 3, (string path, [string currentWorkingDir]?))
  517. {
  518. char *buf = Con::getReturnBuffer(512);
  519. Platform::makeFullPathName(argv[1], buf, 512, argc > 2 ? argv[2] : NULL);
  520. return buf;
  521. }
  522. /*!
  523. */
  524. ConsoleFunctionWithDocs(makeRelativePath, ConsoleString, 3, 3, (string path, string to))
  525. {
  526. return Platform::makeRelativePathName(argv[1], argv[2]);
  527. }
  528. /*!
  529. */
  530. ConsoleFunctionWithDocs(pathConcat, ConsoleString, 3, 0, (string path, string file1, [... fileN]*))
  531. {
  532. char *buf = Con::getReturnBuffer(1024);
  533. char pathBuf[1024];
  534. dStrcpy(buf, argv[1]);
  535. for(S32 i = 2;i < argc;++i)
  536. {
  537. Platform::makeFullPathName(argv[i], pathBuf, 1024, buf);
  538. dStrcpy(buf, pathBuf);
  539. }
  540. return buf;
  541. }
  542. /*!
  543. */
  544. ConsoleFunctionWithDocs(restartInstance, ConsoleVoid, 1, 1, ())
  545. {
  546. Game->setRestart( true );
  547. Platform::postQuitMessage( 0 );
  548. }
  549. <<<<<<< HEAD:engine/source/io/fileSystem_ScriptBinding.cc
  550. /*! creates the path or path to the file name
  551. */
  552. ConsoleFunctionWithDocs( createPath, ConsoleBool, 2,2, (fileName or pathName))
  553. =======
  554. ConsoleFunction( createPath, bool, 2,2, "createPath(\"path\"); creates the path. "
  555. "Verifies all the elements in a path exists or creates them if they do not. "
  556. "Note that the path should end with a slash (/). Otherwise, the last element in the path "
  557. "will be assumed to be a filename and not a path component, and it will not be created. "
  558. "For example \"data/stage2/part1\" will verify or create \"data/stage2/\" and not \"part1\"."
  559. )
  560. >>>>>>> 6e2964681666532c99f49535de98f93c3b6dfb24:engine/source/io/fileSystemFunctions.cpp
  561. {
  562. static char pathName[1024];
  563. Con::expandPath( pathName, sizeof( pathName ), argv[1] );
  564. return Platform::createPath( pathName );
  565. }
  566. ConsoleFunctionGroupEnd(FileSystem)
  567. /*! @} */ // group FileSystem