MCPcopy Create free account
hub / github.com/facebook/SoLoader / getSoFile

Method getSoFile

java/com/facebook/soloader/SoLoader.java:779–809  ·  view source on GitHub ↗

Returns the so file for the specified library. Returns null if the library does not exist or if it's not backed by a file. @param shortName Name of library to find, without "lib" prefix or ".so" suffix @return the File object of the so file

(String shortName)

Source from the content-addressed store, hash-verified

777 * @return the File object of the so file
778 */
779 public static @Nullable File getSoFile(String shortName) {
780 String mergedLibName;
781 if (externalSoMapping != null) {
782 mergedLibName = externalSoMapping.mapLibName(shortName);
783 } else {
784 mergedLibName = MergedSoMapping.mapLibName(shortName);
785 }
786 String soName = mergedLibName != null ? mergedLibName : shortName;
787 String mappedName = System.mapLibraryName(soName);
788
789 sSoSourcesLock.readLock().lock();
790 try {
791 if (sSoSources != null) {
792 for (int i = 0; i < sSoSources.length; ++i) {
793 SoSource currentSource = sSoSources[i];
794 try {
795 File soFile = currentSource.getSoFileByName(mappedName);
796 if (soFile != null) {
797 return soFile;
798 }
799 } catch (IOException e) {
800 // Failed to get the file, let's skip this so source.
801 }
802 }
803 }
804 } finally {
805 sSoSourcesLock.readLock().unlock();
806 }
807
808 return null;
809 }
810
811 public static boolean loadLibrary(String shortName) {
812 return isEnabled ? loadLibrary(shortName, 0) : NativeLoader.loadLibrary(shortName);

Callers

nothing calls this directly

Calls 4

mapLibNameMethod · 0.95
getSoFileByNameMethod · 0.95
lockMethod · 0.80
mapLibNameMethod · 0.65

Tested by

no test coverage detected