diff --git a/scripts/build-darwin.sh b/scripts/build-darwin.sh index 1f59a2c..76ee840 100755 --- a/scripts/build-darwin.sh +++ b/scripts/build-darwin.sh @@ -1,8 +1,9 @@ -go build -C src -o ../build/bemidb-darwin-arm64 - -LIBCPP_PATH=$(otool -L ./build/bemidb-darwin-arm64 | grep -o '/.*/libc++\.1\.0\.dylib') -sudo cp $LIBCPP_PATH ./build/libc++.1.0.dylib +cd src +go build -o ../build/bemidb-darwin-arm64 +cd ../build +LIBCPP_PATH=$(otool -L ./bemidb-darwin-arm64 | grep -o '/.*/libc++\.1\.0\.dylib') +sudo cp $LIBCPP_PATH ./libc++.1.0.dylib sudo cp $LIBCPP_PATH /usr/local/lib/libc++.1.0.dylib -install_name_tool -change $LIBCPP_PATH /usr/local/lib/libc++.1.0.dylib ./build/bemidb-darwin-arm64 -otool -L ./build/bemidb-darwin-arm64 +install_name_tool -change $LIBCPP_PATH /usr/local/lib/libc++.1.0.dylib ./bemidb-darwin-arm64 +otool -L ./bemidb-darwin-arm64 diff --git a/src/storage_local.go b/src/storage_local.go index 32f70d8..b2f0e25 100644 --- a/src/storage_local.go +++ b/src/storage_local.go @@ -4,7 +4,6 @@ import ( "fmt" "os" "path/filepath" - "runtime" "github.com/google/uuid" "github.com/xitongsys/parquet-go-source/local" @@ -26,12 +25,9 @@ func (storage *StorageLocal) IcebergMetadataFilePath(schemaTable SchemaTable) st } func (storage *StorageLocal) IcebergSchemaTables() (schemaTables []SchemaTable, err error) { - _, sourceFilePath, _, ok := runtime.Caller(0) - if !ok { - panic("Failed to get source file path") - } - projectDir := filepath.Dir(sourceFilePath) - schemasPath := filepath.Join(projectDir, storage.config.IcebergPath) + execPath, err := os.Getwd() + PanicIfError(err) + schemasPath := filepath.Join(execPath, storage.config.IcebergPath) schemas, err := storage.nestedDirectories(schemasPath) if err != nil { @@ -176,12 +172,9 @@ func (storage *StorageLocal) CreateVersionHint(metadataDirPath string, metadataF } func (storage *StorageLocal) tablePath(schemaTable SchemaTable) string { - _, sourceFilePath, _, ok := runtime.Caller(0) - if !ok { - panic("Failed to get source file path") - } - projectDir := filepath.Dir(sourceFilePath) - return filepath.Join(projectDir, storage.config.IcebergPath, schemaTable.Schema, schemaTable.Table) + execPath, err := os.Getwd() + PanicIfError(err) + return filepath.Join(execPath, storage.config.IcebergPath, schemaTable.Schema, schemaTable.Table) } func (storage *StorageLocal) fileSystemPrefix() string {