0

I have a project L which is published as a library. Inside L, there is a resources folder and a snippet of code that access the content.

I created a second module in L to add a main as a test, and it works.

Now when I include L into my other project, it doesnt find the folder located inside the resources of L.

in all the below path is equal to folder_i_am_looking_for and I generate varieties with /$path, $path/, $path and /$path/. ( I am desperate at this point )

I tried:

getClass.getClassLoader.getResource(path).getPath,
getClass.getClassLoader.getResource(path).toExternalForm,
getClass.getResource(path).getPath,
getClass.getResource(path).toExternalForm,

as well as

val location: URL = this.getClass.getProtectionDomain.getCodeSource.getLocation
Paths
    .get(location.toURI)
    .resolve("../classes/" + path)
    .normalize()
    .toFile
    .getAbsoluteFile
    .toString

from https://stackoverflow.com/a/54142960

and for each generated path, I've tried to :

input ::
   input.split('!').last ::
   input.split("file:/").last ::
   input.split("file:").last ::
   Nil

from https://stackoverflow.com/a/5346020

each time , i get path that looks like :

/path/to/projectFolder/jar:file:/path/to/library/lib_2.11-version.jar!/folder

I let you imagine all the variety of different path I get with all the above operations. None of them find the directory.

I am testing all path simultaneously with ZIO.validateFirstPar so if you have any idea, I can add more to test.

Thank you.

Wonay
  • 1,160
  • 13
  • 35

0 Answers0