GithubHelp home page GithubHelp logo

Comments (12)

chenchongbiao avatar chenchongbiao commented on June 12, 2024

@18202781743

from dtkcore.

zccrs avatar zccrs commented on June 12, 2024

“如果找不到全局目录,回退到用户目录下的configs-fake-global,但是也是由于没有权限的问题,创建目录的代码并没有成功执行。”

回退到用户目录下的 configs-fake-global 会失败吗?这个情况是不应该的

from dtkcore.

zccrs avatar zccrs commented on June 12, 2024

app data 目录,一般来说用环境变量 DSG_APP_DATA 指定就行。但是无论用环境变量还是用 D_DSG_APP_DATA_FALLBACK 在编译器指定,都有一个前提,那就是发行版或者桌面环境要准备好这个目录,且它符合dtk的需要(不以root身份运行也有权限编辑目标)。

from dtkcore.

zccrs avatar zccrs commented on June 12, 2024

app data目录设计的意义是,dtk需要一个专为应用程序提供的目录,无论这个程序以哪个用户身份执行,这个目录都能被它读写。这个目录会被应用程序存放一些与用户无关的内容(也就是多个用户之间共享的内容),但是Linux中肯定没有符合这种要求的目录,所以默认没有提供,回退到 configs-fake-global 只是能保证存储这一类配置项时不至于丢失,但是达不到“多个用户之间共享”这个目的了。

from dtkcore.

chenchongbiao avatar chenchongbiao commented on June 12, 2024

“如果找不到全局目录,回退到用户目录下的configs-fake-global,但是也是由于没有权限的问题,创建目录的代码并没有成功执行。”

回退到用户目录下的 configs-fake-global 会失败吗?这个情况是不应该的

也会也需要root权限运行才能成功,不使用root权限,无法从成功创建 configs-fake-global 目录

from dtkcore.

chenchongbiao avatar chenchongbiao commented on June 12, 2024

app data目录设计的意义是,dtk需要一个专为应用程序提供的目录,无论这个程序以哪个用户身份执行,这个目录都能被它读写。这个目录会被应用程序存放一些与用户无关的内容(也就是多个用户之间共享的内容),但是Linux中肯定没有符合这种要求的目录,所以默认没有提供,回退到 configs-fake-global 只是能保证存储这一类配置项时不至于丢失,但是达不到“多个用户之间共享”这个目的了。

当然如果是提前准备好该目录,并制定了权限的情况下,不使用root权限也可以正常保存

from dtkcore.

zccrs avatar zccrs commented on June 12, 2024

“如果找不到全局目录,回退到用户目录下的configs-fake-global,但是也是由于没有权限的问题,创建目录的代码并没有成功执行。”
回退到用户目录下的 configs-fake-global 会失败吗?这个情况是不应该的

也会也需要root权限运行才能成功,不使用root权限,无法从成功创建 configs-fake-global 目录

可以看一下拿到的 applicationCacheDir 是什么

from dtkcore.

chenchongbiao avatar chenchongbiao commented on June 12, 2024

使用root情况下成功创建的是root用户的,/root/.config/dsg/configs-fake-global
运行普通用户的时候是在,普通用户目录下的/.config/dsg/configs-fake-global,创建用户缓存的时候是到各自用户目录的/.config/dsg/configs-fake-global下创建
使用了全局缓存的时候是先到/var/dsg/appdata下创建configs目录,当然需要用root权限,否则也是没法创建

from dtkcore.

zccrs avatar zccrs commented on June 12, 2024

/var/dsg/appdata 创建失败是可以预料到的,不算是一个意外情况。

from dtkcore.

chenchongbiao avatar chenchongbiao commented on June 12, 2024

图片
那这个宏没定义呢,如果没加宏这段代码没被运行,globalCacheDir直接获得空字符串,

from dtkcore.

zccrs avatar zccrs commented on June 12, 2024

图片 那这个宏没定义呢,如果没加宏这段代码没被运行,globalCacheDir直接获得空字符串,

正常,这个宏在deepin中不应该被定义。globalCacheDir返回一个空字符串的原因是获取到的 appDataDir 为空(在deepin上应该保证这个不为空),DstandardPaths::DSG::AppData 是靠环境变量指定的,系统应该为程序指定正确的环境变量。

from dtkcore.

chenchongbiao avatar chenchongbiao commented on June 12, 2024

图片 那这个宏没定义呢,如果没加宏这段代码没被运行,globalCacheDir直接获得空字符串,

正常,这个宏在deepin中不应该被定义。globalCacheDir返回一个空字符串的原因是获取到的 appDataDir 为空(在deepin上应该保证这个不为空),DstandardPaths::DSG::AppData 是靠环境变量指定的,系统应该为程序指定正确的环境变量。

好的 明白了

from dtkcore.

Related Issues (20)

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.