(oldPath: string, newPath: string)
| 227 | } |
| 228 | |
| 229 | public renameSync(oldPath: string, newPath: string): void { |
| 230 | // Scenario 1: old and new are on same FS. |
| 231 | const fs1rv = this._getFs(oldPath); |
| 232 | const fs2rv = this._getFs(newPath); |
| 233 | if (fs1rv.fs === fs2rv.fs) { |
| 234 | try { |
| 235 | return fs1rv.fs.renameSync(fs1rv.path, fs2rv.path); |
| 236 | } catch (e) { |
| 237 | this.standardizeError(this.standardizeError(e, fs1rv.path, oldPath), fs2rv.path, newPath); |
| 238 | throw e; |
| 239 | } |
| 240 | } |
| 241 | // Scenario 2: Different file systems. |
| 242 | const data = fs.readFileSync(oldPath); |
| 243 | fs.writeFileSync(newPath, data); |
| 244 | return fs.unlinkSync(oldPath); |
| 245 | } |
| 246 | |
| 247 | public readdirSync(p: string): string[] { |
| 248 | const fsInfo = this._getFs(p); |
nothing calls this directly
no test coverage detected