mqy edited a comment on pull request #8967:
URL: https://github.com/apache/arrow/pull/8967#issuecomment-749648137


   > I wonder if we can use a Cargo environment variable rather than calling 
out to git to find the appropriate paths. For example, I think 
env!("CARGO_MANIFEST_DIR") is the directory containing Cargo.toml.
   
   @alamb [The Cargo Book :: Environment 
Variables](https://doc.rust-lang.org/cargo/reference/environment-variables.html)
 states that:
   ```
   CARGO_MANIFEST_DIR — The directory containing the manifest for **the 
package** being built (the package containing the build script). Also note that 
this is the value of the current working directory of the build script when it 
starts.
   ```
   I've verified with unit test in the "arrow" package, that 
`env!("CARGO_MANIFEST_DIR")` equals to 
`env::current_dir().unwrap().display().to_string()` -- the dir "rust/arrow".
   
   Actually, the most simplest implementation to get "git top level dir" is to 
append "../../" to current dir at present.
   
   I have tried various ways to get the `git top level dir`: 
   
   - find ".git" file or dir from parents of current dir
   - find  dir "rust" from parents of current dir
   - use `git` command -- this is current solution
   
   I prefer that `arrow_test_data()` and `parquet_test_dir()` SHOULD NOT depend 
on the actual dir structure: workspace dir "rust/" or any existing package dir 
("parquet/" for example), or possible deeper nesting dirs. The major reason is: 
these data dirs are **defined (controlled)** by `git submodule` for all sub 
projects,  it's none of the business of underlying dir structures in "apache 
arrow".
   
   Thank you for your review and comments!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to