File tree Expand file tree Collapse file tree 3 files changed +8
-10
lines changed
examples/fileio_rename/src Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,10 @@ void main(void) {
40
40
printText (0 , 0 , "Old Name: " );
41
41
printText (10 , 0 , nameBuffer );
42
42
43
+ /* Close the old file */
44
+ ti_CloseAll ();
45
+
43
46
/* Rename the old file to the new file name */
44
- /* Note: This function closes all open files! */
45
47
ti_Rename (oldName , newName );
46
48
47
49
/* Ensure the new name of the file is correct */
Original file line number Diff line number Diff line change @@ -1163,10 +1163,6 @@ ti_Rename:
1163
1163
push hl ; hl -> old name
1164
1164
push bc
1165
1165
1166
- push af
1167
- call ti_CloseAll
1168
- pop af
1169
-
1170
1166
push de ; new
1171
1167
push de ; new
1172
1168
ld de , OP1
Original file line number Diff line number Diff line change @@ -315,18 +315,18 @@ void ti_GetName(char *name, const ti_var_t slot);
315
315
* @param old Old name of file
316
316
* @param new New name of file
317
317
* @returns 0 if success, 1 if file already exists, 2 any other error occurs.
318
- * @warning: This function closes all open slots!
318
+ * @warning It is potentially hazardous to rename an open file. Be sure to close the open file before renaming,
319
319
*/
320
320
uint8_t ti_Rename (const char * old , const char * new );
321
321
322
322
/**
323
323
* Renames a variable
324
324
*
325
- * @param old Old name of file
326
- * @param new New name of file
325
+ * @param old Old name of variable
326
+ * @param new New name of variable
327
327
* @param type Type of variable to rename
328
- * @returns 0 if success, 1 if file already exists, 2 any other error occurs.
329
- * @warning: This function closes all open slots!
328
+ * @returns 0 if success, 1 if variable already exists, 2 any other error occurs.
329
+ * @warning It is potentially hazardous to rename an open variable. Be sure to close the open variable before renaming,
330
330
*/
331
331
uint8_t ti_RenameVar (const char * old , const char * new , const uint8_t type );
332
332
You can’t perform that action at this time.
0 commit comments