Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help Wanted] Cannot get build directory using codegenerator #1850

Open
kazemcodes opened this issue Apr 22, 2024 · 0 comments
Open

[Help Wanted] Cannot get build directory using codegenerator #1850

kazemcodes opened this issue Apr 22, 2024 · 0 comments

Comments

@kazemcodes
Copy link

in the past version I mean ksp 1.7.10 I was able to get ksp output directory using the code below but right now there is no way to achieve it using old method because I think ksp use daemon to output ksp while using codegenerator if Im not wrong.

    private fun getBuildDir(): String {
        val pathOf = codeGenerator::class.java
            .getDeclaredMethod("pathOf", String::class.java, String::class.java, String::class.java)
        val stubFile = pathOf.invoke(codeGenerator, "", "a", "kt") as String
        //throw Exception("ERROR: Parent -> "+ File(stubFile).absolutePath)
        return if (System.getProperty("os.name").contains("win", true)) {
            File(stubFile).parentFile.parent.replace("\\", "/")
        } else {
            File(stubFile).parentFile.parent
        }
    }

complete code is available over here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant