File tree Expand file tree Collapse file tree
src/project/types/website Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 * Copyright (C) 2020-2022 Posit Software, PBC
55 */
66
7- import { existsSync } from "../../../deno_ral/fs.ts" ;
7+ import { existsSync , safeRemoveDirSync , safeRemoveSync } from "../../../deno_ral/fs.ts" ;
88import { basename , join , relative } from "../../../deno_ral/path.ts" ;
99
1010import { ElementInfo , SAXParser } from "xmlp/mod.ts" ;
@@ -57,7 +57,10 @@ export async function updateSitemap(
5757 const robotsTxtPath = join ( context . dir , "robots.txt" ) ;
5858 const srcRobotsTxt = existsSync ( robotsTxtPath ) ? robotsTxtPath : undefined ;
5959 const destRobotsTxt = join ( outputDir , "robots.txt" ) ;
60- if ( srcRobotsTxt ) {
60+ if ( srcRobotsTxt && destRobotsTxt !== srcRobotsTxt ) {
61+ if ( existsSync ( destRobotsTxt ) ) {
62+ safeRemoveSync ( destRobotsTxt ) ;
63+ }
6164 copyTo ( srcRobotsTxt , destRobotsTxt ) ;
6265 }
6366
You can’t perform that action at this time.
0 commit comments