Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serialization: handle 'null' value from java's File.getParent api #291

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions core/src/main/scala/flatgraph/storage/Serialization.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ object Serialization {
val stringPool = mutable.LinkedHashMap[String, Int]()

// ensure parent directory exists
val parentDir = storagePath.getParent
if (Files.notExists(parentDir)) Files.createDirectories(parentDir)
Option(storagePath.getParent) match {
case Some(dir) => if (Files.notExists(dir)) Files.createDirectories(dir)
case None => // no parent, i.e. we're at the root dir already
}

val fileChannel =
new java.io.RandomAccessFile(storagePath.toAbsolutePath.toFile, "rw").getChannel
Expand Down
1 change: 0 additions & 1 deletion core/src/test/scala/flatgraph/SerializationTests.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package flatgraph

import flatgraph.TestSchema.testSerialization
import flatgraph.misc.DebugDump.debugDump
import flatgraph.storage.{Deserialization, Serialization}
import org.scalatest.matchers.should.Matchers
Expand Down
Loading