zonkyio / embedded-postgres

Java embedded PostgreSQL component for testing
Apache License 2.0
344 stars 43 forks source link

How to get the extraction Path ? #36

Closed ecoinfo-ore closed 4 years ago

ecoinfo-ore commented 4 years ago

Hi,

is there a way to get the exact ans full path ( /tmp/embedded-pg/PG-XYZ ) where the embedded-pg is extraced ? I have to install mysql fdw at runtime and need this path

Another question, with Window, is the embedded-postgres extracted in /tmp ?

Thnak's

tomix26 commented 4 years ago

Hi, the target directory should be printed to the console. There should be a line similar to this: 2020-07-04 23:11:48.321 INFO 16822 --- [ prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres : Postgres binaries at /tmp/embedded-pg/PG-2c0c4f55a015ab253337e3d05ca5fd21

The temp directory is dependent on the platform. The /tmp/embedded-pg/PG-XYZ path is used on Linux platform, /var/folders/fx/xxx/T/embedded-pg/PG-XYZ on MacOS platform and C:\Users\<USER>\AppData\Local\Temp\embedded-pg/PG-XYZ (or sometimes C:\Temp\...) on Windows platform.

rac021 commented 4 years ago

Hi,

Is there a way to get this path programmatically ( at runtime ) ?

Thank''s

tomix26 commented 4 years ago

Not at this moment. The only way to get the path is using reflection. It is stored in io.zonky.test.db.postgres.embedded.EmbeddedPostgres#PREPARE_BINARIES field.