Implement "File open in folder" feature for my C++ application in linux -
I am trying to implement the "Open in folder" functionality that you have seen in Firefox and download managers. This is the code I have picked up so far, and I have decided to use the Nautilix program to open the file.
int file :: openTempFile (std :: string temp_file_dir) {std:: string file_path = temp_file_dir + "/"; File_path = file_path + this- & gt; Additional_info; // If you already have a temporary file, delete it // if (temporary_file! = "") {//: TODO: open temporary file stack // // when app deinit we remove those // (Temporary_file.c_str ()); } / * Write temporary file * / file * fp = fopen (file_path.c_str (), "w"); If returned (fp == NULL) wrong; Filitt (m_data, 1, m_size, fp); Fclose (fp); // Now open it using Netlus / Four * Permalink [] = {strdup ("nautilus"), strdup (file_path.c_str ())}; Int pid; If ((pid = fork ()) == -1) Pillar ("Kanka Fail"); If (pd == 0) {int a = execvp ("notilis", permliext); Printf ("exevp failed to load temporary file"); } Temporary_file = file_path; Return TRUE; }
But error natulux opens three windows and can not understand where my bug is. any idea?
Comments
Post a Comment