You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are off by one slash: argv[0] + ".runfiles". You may also want to do a readlink -f on argv[0], so the most reliable thing is: $(readlink -f $0).runfiles
This gets a bit more complicated if you put a binary in the data attribute of another binary (the same method should work, but alas, it doesn't always), but as long as you are looking at calling binaries on the output of Bazel, you are fine with this mechanism.
I have a binary with some local data:
cc_binary(
name = "sample",
srcs = ["sample.cpp"],
data = glob(["data/test.png"]),
)
I'm wondering how can I get the path to the data directory in C++ code?
Is this a reliable solution: argv[0] + ".run_files/"?
The text was updated successfully, but these errors were encountered: