Questions tagged [pathname]

Anything related to pathnames. A pathname is a symbolic, hierarchical representation of the location of a file (or other resource) in a filesystem encoded as a string. The rules governing the syntax of pathnames differ among OSes (and sometimes among filesystems). Here is an example for Linux: "/home/user/foo/bar/hello.pdf" and one for Windows: "D:\data\foo\bar\hello.pdf"

189 questions
4
votes
0 answers

Confused w Karma: How to test location.pathname?

I'm writing a router and using Karma for TDD. I'm all good with the setup and unit testing with Mocha/Chai/Sinon. My question is, using Karma, how can I test that the browser's location path has changed? In my router, I'm…
asking
  • 1,435
  • 3
  • 13
  • 21
4
votes
1 answer

Ruby - DOS (Win32) path name to NT (native) path name

I need to get the NT (native) path of a file from the DOS (Win32) path in Ruby (1.9.3). Meaning, I have the string: dos_path = "C:\Windows\regedit.exe" but I need: nt_path = "\Device\HarddiskVolume1\Windows\regedit.exe" Is there any way to do…
Guy
  • 137
  • 9
4
votes
4 answers

How to get the full pathname of the current shell script?

Is there a less brute-force way to do this? #!/bin/ksh THIS_SCRIPT=$(/usr/bin/readlink -f $(echo $0 | /bin/sed "s,^[^/],$PWD/&,")) echo $THIS_SCRIPT I'm stuck using ksh but would prefer a solution that works in bash too (which I think this does).
Dan
  • 5,929
  • 6
  • 42
  • 52
4
votes
2 answers

How to reference a file to be opened in C++ given that its full path name will change from computer to computer?

Our Computer Science teacher has given us a project to make a fully functioning console application using C++. And I have started to make it. But I got stuck at some point. I want to open an editable text (.txt) file using the open() function. But I…
radiantshaw
  • 535
  • 1
  • 5
  • 18
3
votes
1 answer

String path with spaces in TCL not working

Why can't i do this in TCL: set path "|C:/Program Files/Example/My Program/prgrm.exe" The string path will get the value: "C:/Program". But if I remove the spaces it will get the full path... Anyone got an idea?
Afra
  • 2,502
  • 3
  • 24
  • 27
3
votes
2 answers

Validating a path in Perl

I am working on a lab for a class I am taking and I have a question about checking Perl strings for specific input. Essentially what I want to be able to do is make sure that the input I am receiving from a user is something like: /home/[anything is…
Nathan Anderson
  • 155
  • 1
  • 2
  • 7
3
votes
5 answers

How can I get pathname values from url in JavaScript?

I have this: http://example.com/iu4pa9rm8vfh.html?param_1 I want this: iu4pa9rm8vfh var url ="http://example.com/iu4pa9rm8vfh.html?param_1"; document.getElementById("demo").innerHTML = "The pathname of this page is :" + url.pathname; Thanks…
3
votes
1 answer

Why does this combination of curly braces and double quotes not work in bash?

I'm trying to understand how to use curly braces and quotes properly in bash. I'm wondering why the third example of an ls command doesn't work. #!/bin/bash -vx # File name prefix. File_name_prefix='this_is_a_file_name_prefix' # Let's do this in…
Llewen
  • 31
  • 4
3
votes
1 answer

What function does Linux use to get an absolute path?

If the kernel or a kernel module has a path that has symbolic link components, is relative, or is both, what function does it use to turn ../bob into /home/bob or /etc/mtab into /proc/self/mount? How can I also get the absolute path of a file as it…
Melab
  • 2,594
  • 7
  • 30
  • 51
3
votes
1 answer

Get canonical path from pathname

I am writing a kernel module that hijacks several system calls. Several of the system calls take paths as parameters. For my purposes, I need to work with full paths, but since these parameters are passed as strings, it could be anything like…
Melab
  • 2,594
  • 7
  • 30
  • 51
3
votes
2 answers

Perl function to normalize path with spaces?

I'm in maintenance mode and I'm working with a Perl script that is run on Apple, Linux, Windows and Unix. Some Apple and Linux and most Windows have spaces in the path. On Windows, the long file name needs quotes. On Apple and Linux the space needs…
jww
  • 97,681
  • 90
  • 411
  • 885
3
votes
1 answer

How to move a file in Lisp using rename-file

What's the best way to move a file in Lisp in an implementation-independent way? For example I have an image file: (setq oldpath #P"SERVER:PICTURES;TEMP;PHOTO.PNG") and I want to move it out of the TEMP directory into the PICTURES directory. This…
johnsondavies
  • 437
  • 3
  • 10
3
votes
4 answers

How to use window.location to highlight the active menu item?

I'm using following code of JQuery to add a class name to the active menu item according to the URL of the menu item: var aurl = window.location.pathname; $('.menu li a[href="'+aurl+'"]').parent('li').addClass('active'); The problem isn't in the…
Orthemes
  • 93
  • 2
  • 6
3
votes
2 answers

in Jquery, How can I use If/else with window.location.pathname.indexOf?

I have a website that is broken into 4 subcategories. each category contains html files that I would like to alter depending on the parent category. Basically, I want jquery to read the folder name of the HTML document and depending on the name,…
pat
  • 65
  • 1
  • 9
3
votes
1 answer

Pathname attacks using CGI

this is an assignment for my computer security class, so I don't need specific answers, but I'd like some advice or at least general direction since I've been going in circles for a while. Basically, we have an assignment where we've been given a…
user1777900
  • 975
  • 3
  • 13
  • 27
1 2
3
12 13