Skip to content

startSocsimWithFile() crashes when supfile contains more than a basename #20

@ohexel

Description

@ohexel

If supfile contains more than the basename, i.e. some_directory/my_sup_file.sup instead of my_sup_file.sup, the process will crash inside startSocsimWithFile().

I'd guess the problem is in line 277 or 275 of events.cpp, based on what gets written to stdout before the crash.

The documentation is wrong to state that every sup and rate file should be referred to relative to folder. Currently, sup and rate files must be directly under folder for everything to work.

dir.create("tmp/tmp", recursive = TRUE)
tmpdir <- file.path(getwd(), "tmp/tmp")
dir.exists(tmpdir)
supname <- create_sup_file(simfolder = tmpdir)
file.exists(file.path(tmpdir, supname))
file.exists(file.path(getwd(), "tmp/tmp", supname))
identical(file.path(tmpdir, supname),
          file.path(getwd(), "tmp/tmp", supname))
# This works
socsim(folder = tmpdir,
       supfile = supname)
# This does not work
socsim(folder = file.path(getwd(), "tmp"),
       supfile = file.path("tmp", supname))

The behavior happens whether the base directory is inside the working directory or not.

dir.create("U:/tmp/tmp", recursive = TRUE)
tmpdir <- "U:/tmp/tmp"
dir.exists(tmpdir)
supname <- create_sup_file(simfolder = tmpdir)
file.exists(file.path(tmpdir, supname))
file.exists(file.path("U:/tmp", "tmp", supname))
identical(file.path(tmpdir, supname),
          file.path("U:/tmp", "tmp", supname))
# This works
socsim(folder = tmpdir,
       supfile = supname)
# This does not work
socsim(folder = "U:/tmp",
       supfile = file.path("tmp", supname))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions