0

MACの指定されたフォルダに一時ファイルを作成する必要があります。ただし、正しい場所にフォルダを作成することはできますが、内部にファイルを作成することはできません。フォルダの作成中にファイルのアクセス許可として777を渡しましたが、ファイルを作成するためのアクセス許可がないというエラーが表示されます。以下の私のコードを見つけてください。この問題はMACでのみ発生します。Windowsでは、期待どおりに実行されます。問題点を教えてください。

    wxString curDir = SeeWorkingDir() + wxT("Temp\\"); //Gets the working directory

    if(!wxFileName::DirExists(curDir)) //Checks if directory exists
    wxFileName::Mkdir( curDir, 0777, wxPATH_MKDIR_FULL ); // creates the directory

    wxString jobcopy = wxFileName::CreateTempFileName(curDir); // should create temp file
4

2 に答える 2

1

I have absolutely no idea what your "SeeWorkingDir()" function is returning, but if it's returning the application directory then you shouldn't be writing anything into there.

Why not replace "SeeWorkingDir()" with a path to somewhere on the Macintosh that truly is writable, like the "/tmp/" directory?

于 2012-05-25T10:22:17.943 に答える
0

SeeWorkingDir()関数の機能については説明していません。

たぶんwxFileName::GetTempDir、ファイルを保存するディレクトリを指定するために使用する必要があります。これはプラットフォームに依存しない必要があります。

または、wxFileName :: CreateTempFileName(curDir)の呼び出しでfileTemp、ファイルを直接開くためのパラメーターを指定できます。

ドキュメントを参照してください: wxWidgets 2.8.12-wxFileName

于 2012-06-03T12:49:14.703 に答える