Skip to content

Commit

Permalink
Don't delete symlink to root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
aburgm committed Feb 3, 2023
1 parent 174aba4 commit e9f9193
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ func runSync(cmd *cobra.Command, args []string) {
workspaceModuleName := module.OpenModule(workspaceRoot).Name()
log.Debug("Workspace module name: '%s\n", workspaceModuleName)

workspaceModuleSymlink := ""
if workspaceModuleFile.Layout != "cpp" {
// Create the DEPS/ subdirectory and create a symlink to the top-level module.
workspaceModuleSymlink := path.Join(workspaceRoot, util.DepsDirName, workspaceModuleName)
workspaceModuleSymlink = path.Join(workspaceRoot, util.DepsDirName, workspaceModuleName)
if !util.DirExists(workspaceModuleSymlink) {
log.Debug("Creating symlink for the workspace module: '%s/%s' -> '%s'.\n", util.DepsDirName, workspaceModuleName, workspaceRoot)
util.MkdirAll(path.Dir(workspaceModuleSymlink))
Expand Down Expand Up @@ -191,7 +192,7 @@ func runSync(cmd *cobra.Command, args []string) {
if content != nil {
for _, info := range content {
fullPath := path.Join(depsDir, info.Name())
if !done[fullPath] {
if !done[fullPath] && fullPath != workspaceModuleSymlink {
log.Log("Deleting '%s'\n", fullPath)
os.RemoveAll(fullPath)
}
Expand Down

0 comments on commit e9f9193

Please sign in to comment.