Accessing target of a windows shorcut - r

In linux machines, it is possible to access where a symbolic link is pointing to by using Sys.readlink function in R or readlink from the command line. Reading its documentation, we see that this is not intended for Windows shortcuts.
In Windows I have not been able to find a one liner to give me where the file points to. The closest I got was from this SO question that demonstrates the use of dir. While the output was not perfect I figured with some regex magic I could isolate the file path.
However when I tried system2('dir'), I received the error "dir" not found.
Is there (a better) way for me to access the file path of a Windows shortcut from R and why can't I use dir through a system call in R?

For anyone in the future finding this thread, the answer is fs::link_path() as pointed out by Edward Visel

Related

How to mask a folder name differently to WSL?

I am using Microsoft's OneDrive for Business provided by our university to sync big junks of data. I'm also using using a software to run some simulations which is not available for windows and I have to use WSL. Now the issue is that OneDrive folder name is like OneDrive - University of foobar and the software I'm using refuses to accept path names with spaces in it. Unfortunately as far as I know Microsoft has made it impossible to change the folder name for OneDrive for business. I have to find a way to fool WSL to think the folder name is different. something without spaces!
What I have tried:
I have tried ln -s link target but when running the software it considers the original folder
I have tried mount --bind link target but it behaves weirdly and I didn't get what I needed
I also tried the windows side using mklink /D link target it did not work either.
I would appreciate if you could help me know if there are any solutions to let the WSL see the folder name differently.
Wrong solution
Thanks to this post on Reddit I was able to solve this issue. I was using ln in a wrong way. The correct form is:
ln -s /target/path/with\ spaces/ /path/to/link/file
where file must not exist beforehand. Now WSL treats file as the target folder!

Why isn't R or Rscript executing on my Windows box?

I can't seem to run R.EXE or RSCRIPT.EXE. However, it works if it's in a directory that doesn't contain any spaces. Is this a limitation of the application itself?
I found a solution. This occurs because 8dot3 naming convention is disabled! For anyone else having this issue, and I saw there were others, you can re-enable it but if the directory is already created then it can't easily re-create a short name for it.

set path in rstudio

Can anyone please guide me setting up the path in rstudio, why I cant change present working directory. what if I want to save a file on desktop and pull up the file in Rstudio.
Your help is appreciated.
thanks, sandy
Some of the most common reasons I have found where setting directory was a problem with the solution
Forgot the "" marks around the path example of correct setwd("Libraries/Documents")
Working in Windows and forgot to switch the back-slash to a forward slash, examples: WRONG-> "Libraries\Documents" RIGHT->"Libraries/Documents"
There path is on a shared system where they system denies that access (we have remote folders on servers at work that cannot be addressed this way)...IT security
The directory is not actually mapped as you stated, example possibly you do not need the Libraries part or you have to expressly include another level of folders above your current address
The directory has a different name, a capital letter, a space in it or something making addressing it on your system difficult
You are actually already in the wanted directory. as joel said, try getwd() to see where it says you are.
If none of this is your problem, post the error message and your system (linux, OS10.?, Windows 7 pro) and they setwd("path_to_stuff") you are using and we can try to get to the heart of the matter better.

Phabricator SVN Revision file context

I cannot get phabricator to display the changes in using the file context. I got the "Context not available" on every file.
Does anyone know why is this not work? What should i do to debug this problem?
This seems a problem related with SVN only because its working with GIT.
Thanks.
I bumped in the same problem recently and googled this question. I found out that the context is available only when diff is created via arcanist command line tool (arc diff) in Linux or Mac OS.
It won't work if you create a diff directly by pasting it in Phabricator/Differential or by using arcanist tool in Windows.
I tested this with arcanist on Ubuntu 14.04, Mac OS 10.10 (those two worked) and in Windows 7 (didn't work).
You didn't specify whether you're using the arc diff command line tool, or manually uploading a diff via the Phab. web interface.
If you're not using arc diff, I have an answer for you: It's up to you to include the context yourself. Phab. only knows what's in the diff/patch that you give it. If you can't get the full context, that's a fault with your diff/patch, not with Phab.
If you're using a standard diff utility, like GNU diff, you can use the command-line arguments to dictate how much context to include in the output. I usually use some obscenely large number, like 500 or 1000, to ensure that the entire file ends up in the output.
I just took a quick look at the svn command-line documentation, and it seems that there's no way to control how much context goes into the output. ...but maybe I'm wrong...
In any case, shortboy is correct that the easiest way to get the full file context is to use arc diff.

Couple of basic questions about Julia on Windows

I run Julia on Windows with the julia.bat file given in the zip archive. I have a couple of basic questions. This launches a DOS console.
When typing a plot() command Julia returns plot not defined. How to use the plot() function ? Is there a graphical interface available ?
When typing help I get:
What does it mean ?
There is also the launch-julia-webserver.bat file in the zip archive. When running this file two DOS windows open but nothing else happens. What can we do with this file and how ?
By the way I do not find any documentation answering such basic questions... of course if you know where to find such a documentation it would be an ideal answer.
To answer your immediate question, help is implemented as a function, and functions must be called with parentheses. Try help(), or to get help for a particular function in the standard library supply it as an argument; i.e., help(help).
When you enter a function name without the parentheses, the default is to print all of the implementations with their argument types.
The main Julia documentation is available online at http://docs.julialang.org/. We also have a mailing list at https://groups.google.com/forum/#!forum/julia-dev.
The webserver is pretty rough, especially on Windows. You should be able to open up http://localhost:2000/ with it running and access a web-based command environment. But you'll probably just want to stick to the normal command line.
Another contributor highlighted the response to help as a potential issue for new users and we've opened a bug on it at https://github.com/JuliaLang/julia/issues/1320. It's a new language and there's still plenty of rough edges, so thanks for helping us file those down!
To use launch-julia-webserver.bat, after you double-click it and the two DOS windows open, one of them should say "Connect to http://localhost:2000/ for the web REPL". If you open a web browser to http://localhost:2000/, you should be greeted with a welcome page that asks for your name and a session name.

Resources