Skip to content

Commit 18faadb

Browse files
committed
Fix relative package directory for currdir
1 parent 3f70ba3 commit 18faadb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/Stack/Init.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ initProject mresolver initOpts = do
6969
let dest = currDir </> stackDotYaml
7070
dest' = toFilePath dest
7171
exists <- fileExists dest
72-
when exists $ error "Invariant violated: in toBuildConfig's Nothing branch, and the stack.yaml file exists"
72+
when exists $ error "Refusing to overwrite existing stack.yaml, please delete before running stack init"
7373

7474
cabalfps <- findCabalFiles currDir
7575
$logInfo $ "Writing default config file to: " <> T.pack dest'
@@ -92,7 +92,9 @@ initProject mresolver initOpts = do
9292
{ peValidWanted = True
9393
, peLocation = PLFilePath $
9494
case stripDir currDir $ parent fp of
95-
Nothing -> assert False $ toFilePath fp
95+
Nothing
96+
| currDir == parent fp -> "."
97+
| otherwise -> assert False $ toFilePath $ parent fp
9698
Just rel -> toFilePath rel
9799
, peSubdirs = []
98100
}

0 commit comments

Comments
 (0)