C#Path.Combine没有使用AppData位置(C# Path.Combine is not using AppData location)
我试图访问
AppData
文件夹以根据需要创建/删除目录,但使用Path.Combine
只产生所需路径的一半。 以下是我的:string sPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string test = Path.Combine(sPath, @"\Microsoft\Windows\Start Menu\SkillControl\");
测试字符串代替下一行(工作时)的
Directory.CreateDirectory
。 以下是调试这些行的结果:sPath: "C:\\Users\\[user]\\AppData\\Roaming" test: "\\Microsoft\\Windows\\Start Menu\\SkillControl\\"
我期待“测试”结果的完整路径:
C:\\Users\\[User]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\SkillControl\\
但它似乎忽略了组合功能。 任何人都可以解决为什么?
为了在提出问题之前进行澄清,
sPath
只是确认Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
是否正确拉取正确位置的一种方式,在做这件事时我会得到相同的结果Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Microsoft\Windows\Start Menu\SkillControl\"));
I'm trying to access the
AppData
folder to create/delete directories as needed but usingPath.Combine
is yielding only half the desired path. Here's what I have:string sPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string test = Path.Combine(sPath, @"\Microsoft\Windows\Start Menu\SkillControl\");
The test string is in place of a
Directory.CreateDirectory
which is the next line (when working). Here are the results of debugging these lines:sPath: "C:\\Users\\[user]\\AppData\\Roaming" test: "\\Microsoft\\Windows\\Start Menu\\SkillControl\\"
I was expecting "test" to result in the full path:
C:\\Users\\[User]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\SkillControl\\
but it seems to ignore the combine function. Can anyone work out why?
To clarify before it's asked,
sPath
is just a way for me to confirm ifEnvironment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
was pulling the correct location which it is, I get the same results when doingPath.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Microsoft\Windows\Start Menu\SkillControl\"));
原文:https://stackoverflow.com/questions/50513427
最满意答案
我正在使用
window.location.reload(true)
根据MDN (和这个类似的问题)它强制页面从服务器重新加载。您可以在浏览器中通过在地址栏中输入
javascript:location.reload(true)
来执行此代码。
相关问答
更多-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
我正在使用window.location.reload(true)根据MDN (和这个类似的问题)它强制页面从服务器重新加载。 您可以在浏览器中通过在地址栏中输入javascript:location.reload(true)来执行此代码。 I'm using window.location.reload(true) according to MDN (and this similar question) it forces page to reload from server. You can execu ...
-
有更复杂的解决方案,但一个非常简单,简单的只是添加一个随机查询字符串到您的CSS包括。 如src="/css/styles.css?v={random number/string}" 如果您使用php或其他服务器端语言,则可以使用time()自动执行此操作。 那么它将是styles.css?v==time();?> 这样,每一次查询字符串都将是新的。 像我说的那样,还有更复杂的解决方案更具动态性,但是在测试目的中,这种方法是顶级的(IMO)。 There are much more complicate ...
-
如果您打开了开发工具(F12 / Ctrl-Shift-I / Cmd + Opt + I,Chrome菜单→更多工具→开发工具),则可以显示重新加载菜单。 If you have the Developer Tools open (F12 / Ctrl-Shift-I / Cmd + Opt + I, Chrome Menu → More tools → Developer Tools), then the reload menu can appear.
-
Chrome可以使用“ Extensions Reloader ” : 使用扩展程序的工具栏按钮或浏览到“ http://reload.extensions ”来重新加载所有解包的扩展名 如果您已经开发了Chrome扩展程序,则可能需要自动执行重新加载解压缩扩展的过程,而无需浏览扩展页面。 “Extensions Reloader”允许您使用以下两种方法重新加载所有解压缩的扩展: 1 - 扩展的工具栏按钮。 2 - 浏览到“ http://reload.extensions ”。 工具栏图标将使用一次点击重 ...
-
如何强制Chrome的脚本调试器重新加载javascript?(How to force Chrome's script debugger to reload javascript?)[2021-11-16]
在开发脚本时,请尝试禁用Chrome缓存: 当您重新加载页面时,JavaScript应该会刷新。 While you are developing your script, try disabling the Chrome cache. When you reload the page, the JavaScript should now get refreshed. Chrome circa 2011 Chrome circa 2018 You can also access it on the netw ... -
正常重新加载 与F5相同的事情。 这将使用缓存,但在页面加载期间重新验证所有内容,寻找“304未修改”响应。 如果浏览器可以避免重新下载缓存的JavaScript文件,图像,文本文件等,那么它会。 硬重新加载 发出请求时,不要在缓存中使用任何东西。 强制浏览器重新下载每个JavaScript文件,图像,文本文件等。 空缓存和硬重新加载 显然,如果缓存为空,那么它将不得不做一个重新加载。 这将再次强制浏览器重新下载所有内容。 但是,如果页面通过JavaScript进行任何不是页面加载的事后下载,那么这些可能仍 ...
-
讨厌回答我自己的问题,但我通过以下方式实现了这一目标: 更改: Cursor mCur = getContentResolver().query(uriCustom, proj, sel, null, null); 至 Cursor mCur = getContentResolver().query(uriCustom, proj, sel, null, BookmarkColumns.DATE + " ASC"); Hate to answer my own questions, but I achi ...
-
我发现了怎么做。 window.onbeforeunload = function (e) { $("html,body").hide(); }; I found how to do it. window.onbeforeunload = function (e) { $("html,body").hide(); };
-
将两个图像加载到单独的div中,然后在当前可查看的一个上设置display:inline,在另一个上显示:none。 然后,您可以通过更改CSS显示属性来切换两个图像。 Load both images in separate divs, then just set display:inline on the currently viewable one, and display:none on the other. Then you can just toggle the two images by ch ...