Giter Club home page Giter Club logo

appdirs's People

Contributors

clashsoft avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar harawata avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

appdirs's Issues

java.lang.NoClassDefFoundError: com/sun/jna/platform/win32/Shell32

I am using appdirs in a JavaFX application. appdirs throws exception in Windows 7 as below:

Exception in thread "JavaFX Application Thread" Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.NullPointerException
        at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:383)
        at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
        ... 5 more
java.lang.NoClassDefFoundError: com/sun/jna/platform/win32/Shell32
        at net.harawata.appdirs.impl.ShellFolderResolver.resolveFolder(ShellFolderResolver.java:38)
        at net.harawata.appdirs.impl.WindowsAppDirs.getLocalAppData(WindowsAppDirs.java:71)
        at net.harawata.appdirs.impl.WindowsAppDirs.getUserDataDir(WindowsAppDirs.java:33)
        at net.harawata.appdirs.AppDirs.getUserDataDir(AppDirs.java:28)
        at com.erayerdin.corpustk.App.<clinit>(App.java:19)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$155(LauncherImpl.java:352)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformI
mpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.platform.win32.Shell32
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 16 more

It works in Linux, though. Adding com.sun.jna as a Maven dependency does not work as well.


Environment

  • Microsoft Windows [Version 6.1.7601] (stands for Windows 7)
  • Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
  • Appdirs 1.0.0

ConfigDir on MacOSX

Shouldn't it point to Library/Preferences instead of Library/Application Support?

Since the preferences folder isn't removed when the application is uninstalled and can be migrated when upgrading the Mac, I think it makes sense to store user configuration inside this folder instead of Application Support, that is also available using DataDir.

AppDirs dosn't show up in Intellij idea

Hello !
Thank you for wonderfull library. But I can't make it work.
Firstly I added library into pom.xml of my project the latest version of library.

**

net.harawata

<artifactId>appdirs</artifactId>

<version>1.2.1</version>

**

But when I try to write into class this library my project dosn't see (I was wondering how).

Снимок экрана 2021-09-07 в 12 37 02

When I pay attentiong that this library include of in maven but not showing in maven toolbar that has in intellij idea in left toolbar.

Снимок экрана 2021-09-07 в 12 37 49

If you see below. You could see all dependecies that written in pom xml has in left toolbar but not AppDirs library. Please could you help me to figure it out about it. How I could make to show up this library in my project

Thanks in advance

Cannot initialize logger appender

I'm using slf4j with logback. I created custom FileAppender and I wanted to select destination of log file using appdirs. Unfortunately the lib uses the logging itself so it became an circular dependency - my appender needs appdirs, appdirs needs logging and logging needs my appender. Not sure how to address this issue.

Support for C:\Users\<Account>\AppData\<AppName> pattern

You have many patterns, but too many parameters aren't optional, and I don't want to use version and appAuthor.

Especially version may make no sense if an app wants to find the existing data after an upgrade, and continue using it....

Publish jar on maven central

Hello,
i am really missing a library like this for jvm development.
I am used to using the appdirs module in python.

Would you mind publishing this library as a jar to maven central or some comparable repository?

It would help us a lot!

Appdirs using logger loads log configuration before being able to set the log directory via appdirs

This very much relates to #4

I'm trying to use AppDirs to set my log file directory, but AppDirs using a logger itself makes this very difficult as it loads my logger before I am able to set my logging directory system property to a path obtained by AppDirs.

If you want to keep logging in AppDirs (Which at this time is only used in ShellFolderResolver and AppDirsFactory), how about some method of obtaining an AppDirsFactory with a disabled logger?

public class AppDirsFactory {
    private static Logger logger;

    private AppDirsFactory() {
        super();
    }

    public static AppDirs getInstanceWithoutLogger() {
        logger = NOPLogger.NOP_LOGGER;
        return createInstance(false);
    }

    public static AppDirs getInstance() {
        logger = LoggerFactory.getLogger(AppDirsFactory.class);
        return createInstance(true);
    }

    private static AppDirs createInstance(final boolean logging) {
        String os = System.getProperty("os.name").toLowerCase();
        if (os.startsWith("mac os x")) {
            // ...
        } else if (os.startsWith("windows")) {
            logger.debug("os.name {} is resolved to Windows", os);
            // do the same in ShellFolderResolver
            WindowsFolderResolver folderResolver = new ShellFolderResolver(logging);
            return new WindowsAppDirs(folderResolver);
        } else {
            // ...
        }
    }
}

I realize this isn't super pretty, but I feel like something like this is much needed. Not creating a logger while trying to find out which directory to log to would improve this already excellent little library, and I feel like this must be a pretty common use case.

Mac permissions prevent use of getSiteDataDir

Java apps don't automatically have permission to write to /Library/Application Support/

It may be better to return /Users/Shared/ or /Users/Shared/Library/Application Support/ which automatically has permissions for all users.

Support for Windows Server (2016)

Calling appDirs.getUserDataDir() throws an Exception on Windows Server 2016 (and maybe other versions of Windows Server):

java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
        at com.sun.jna.platform.win32.Shell32.<clinit>(Shell32.java:32)
        at com.sun.jna.platform.win32.Shell32Util.getFolderPath(Shell32Util.java:44)
        at com.sun.jna.platform.win32.Shell32Util.getFolderPath(Shell32Util.java:61)
        at net.harawata.appdirs.impl.ShellFolderResolver.resolveFolder(ShellFolderResolver.java:47)
        at net.harawata.appdirs.impl.WindowsAppDirs.getLocalAppData(WindowsAppDirs.java:75)
        at net.harawata.appdirs.impl.WindowsAppDirs.getUserDataDir(WindowsAppDirs.java:33)
        at net.harawata.appdirs.AppDirs.getUserDataDir(AppDirs.java:20)

I was able to reproduce this exception on a new clean VM with just a Test-Application only calling this method. I tested with Java 9 and Java 14, both have the same Issue. I'm using the latest 1.2.0-Version.

On my Windows 10 System everything works fine.

Java properties vs environment variables

Either I am missing something, or you read XDG variables in the wrong place.

XDG_DATA_HOME, XDG_RUNTIME_DIR, etc are environment variables. But you're trying to read them using System.getProperty.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.