changeFilenameSync method
Synchronously changes only the name of this file.
See also changeFilename.
Implementation
File changeFilenameSync(
String newFileName, {
lib_path.Context? pathContext,
}) {
pathContext ??= lib_path.context;
final lastSeparatorIdx = path.lastIndexOf(pathContext.separator);
final newPath = path.substring(0, lastSeparatorIdx + 1) + newFileName;
return renameSync(newPath);
}