You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

simonb

Beginner

  • "simonb" is male
  • "simonb" started this thread

Posts: 28

Location: Jerusalem,Israel

  • Send private message

1

Sunday, August 14th 2011, 6:56pm

Can't open folder with Qprocess

Hi. I'm trying to open the "My documents" folder via QProcess
I used the examples from the QProcess Class Reference.

Source code

1
2
QProcess process;
process.start("dir "My Documents"");


Source code

1
2
QProcess process;
 process.start("dir """My Documents"""");


both not working...need help please ?(

Thanx!

Junior

Professional

  • "Junior" is male

Posts: 1,623

Location: San Antonio, TX USA

Occupation: Senior Secure Systems Engineer

  • Send private message

2

Monday, August 15th 2011, 1:09pm

simonb,

Open and terminal window and try the command you are wanting to pass into QProcess. If it works at command line in the terminal window, then it should work (formatted correctly).

simonb

Beginner

  • "simonb" is male
  • "simonb" started this thread

Posts: 28

Location: Jerusalem,Israel

  • Send private message

3

Monday, August 15th 2011, 3:47pm

I tried to run on my terminal "c:/" and it work
but no with
process.start("c:/");

what I'm doing wrong?

Junior

Professional

  • "Junior" is male

Posts: 1,623

Location: San Antonio, TX USA

Occupation: Senior Secure Systems Engineer

  • Send private message

4

Monday, August 15th 2011, 4:26pm

Hmmm, I tried with c:/ in terminal and it failed.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
C:\>c:/
'c:/' is not recognized as an internal or external command,
operable program or batch file.

C:\>c:\
'c:\' is not recognized as an internal or external command,
operable program or batch file.

C:\>dir c:\
 Volume in drive C has no label.
 Volume Serial Number is 141F-A895

 Directory of c:\
// output
               4 File(s)          1,111 bytes
              18 Dir(s)  37,886,693,376 bytes free

C:\>dir c:/
Invalid switch - "".


It did work if I used the correct syntax "dir c:\" verse "dir c:/"

simonb

Beginner

  • "simonb" is male
  • "simonb" started this thread

Posts: 28

Location: Jerusalem,Israel

  • Send private message

5

Tuesday, August 16th 2011, 8:51am

Haa ok, My mistake i thought to use the "run" in the windows start menu...

still I tried again with

Source code

1
2
QProcess process;
process.start("dir "My Documents""); 


and it dosen't work...

Thanx!

simonb

Beginner

  • "simonb" is male
  • "simonb" started this thread

Posts: 28

Location: Jerusalem,Israel

  • Send private message

6

Sunday, August 21st 2011, 10:16am

Any idea?? plss

Junior

Professional

  • "Junior" is male

Posts: 1,623

Location: San Antonio, TX USA

Occupation: Senior Secure Systems Engineer

  • Send private message

7

Tuesday, August 23rd 2011, 1:47pm

I checked with Qt bugs and found quite a few in reference to this. Each saying it is going to be fix in the next release of course.
It seems to be a problem with what version your using on windows. Not sure of your environment. I would file a bug against it.

simonb

Beginner

  • "simonb" is male
  • "simonb" started this thread

Posts: 28

Location: Jerusalem,Israel

  • Send private message

8

Sunday, August 28th 2011, 9:01am

I'm using Qt Creator 2.0.1 Based on Qt 4.7.0 (32 bit)
On Windows xp Service pack 3

9

Tuesday, August 30th 2011, 3:03am

The "My documents" folder is a short cut to a directory not a real directory.
If you can work with that limitation I think you'll find it works

simonb

Beginner

  • "simonb" is male
  • "simonb" started this thread

Posts: 28

Location: Jerusalem,Israel

  • Send private message

10

Tuesday, August 30th 2011, 2:40pm

I tried to give the full location and still dosen't works...

I want to be able to open folder as same as from "Start->Run" on windows.

Is there any outher way?
Thanx!

Junior

Professional

  • "Junior" is male

Posts: 1,623

Location: San Antonio, TX USA

Occupation: Senior Secure Systems Engineer

  • Send private message

11

Tuesday, August 30th 2011, 3:10pm

This seem to work because Qt includes the stdlib.

main.cpp

Source code

1
2
3
4
5
6
7
8
#include <QtCore>

int main()
{
	system( "dir c:\" );
	
	return 0;
}

simonb

Beginner

  • "simonb" is male
  • "simonb" started this thread

Posts: 28

Location: Jerusalem,Israel

  • Send private message

12

Thursday, September 1st 2011, 11:44am

Thanx for the replay!

Your code open's the folder in the cmd window form

But I want to open the folder in windows form...

Thanx again

simonb

Beginner

  • "simonb" is male
  • "simonb" started this thread

Posts: 28

Location: Jerusalem,Israel

  • Send private message

13

Thursday, September 1st 2011, 12:31pm

Found the solution using QDesktopServices

Source code

1
 QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop", QUrl::TolerantMode));


Thanx!