从Finder和Xcode运行OSX App的区别? [英] Differences between running OSX App from Finder versus Xcode?

查看:90
本文介绍了从Finder和Xcode运行OSX App的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Finder运行OSX App与Xcode的区别???

Differences between running OSX App from Finder versus Xcode ???

系统是运行Mavericks OSX 10.9.5和最新Xcode 6.0.1的iMac 27英寸多合一机器

System is iMac 27" all-in-1 running Mavericks OSX 10.9.5 and latest Xcode 6.0.1

该应用程序读取一个二进制文件并写入两个文本文件,可以重新写入该二进制文件,并绘制一个 窗口客户区.

The App reads a binary file and writes two text files, may re-write the binary file, and draws in a window client area.

应用程序完全在Xcode中运行.应用程序,二进制文件和两个文本文件位于〜/Debug或〜/Release目录中. 写入文件没有问题.文件I/O代码可以做到这一点……

App totally runs in Xcode. App, binary file and two text files are in ~/Debug or ~/Release directory. No problem writing to files. File i/o code does this…

std::fstream out(  binary_file, std::ios::in|std::ios::binary);
if ( out )
out.read(buffer, MaxBuffer);
out.close();

ofstream info("info_file.txt");
if ( info.is_open() )
info << text;
info.close();
system("chmod 777 info_file.txt"); //tried this, doesn’t help

ofstream clout("clout_file.txt");
if ( clout.is_open() )
clout << text;
clout.close();
system("chmod 777 clout_file.txt"); //tried this, doesn’t help

从Finder运行(双击)时,应用程序无法写入文件.无论应用程序和文件位于何处……

App cannot write to files when run (double clicked) from Finder. Regardless of where App and files are located…

/Users/myname/Applications/Appname

/Users/myname/Applications/Appname

/Users/myname/Library/Application Support/Appname

/Users/myname/Library/Application Support/Appname

其他

我应该说该应用程序是Xcode内置的存档/发行版本,并放置在目标目录中 查找器情况.这是正确的方法吗?这是我的第一个OSX App,但我一直在为 几十年.

I should say the App is Archive/Release built in Xcode and placed in destination directory for Finder situation. Is this the right way? This is my first OSX App but I’ve been programming for decades.

Finder情况的权限是

Permissions for Finder situation are

应用:我的名字已读&写,员工只读,所有人只读 二进制文件:myname读取&写作,员工阅读和学习写作,每个人都阅读&写 文本文件:myname读取&写作,员工阅读和学习写作,每个人都阅读&写

App: myname Read & Write, staff Read only, everyone Read only binary file: myname Read & Write, staff Read & Write, everyone Read & Write text files: myname Read & Write, staff Read & Write, everyone Read & Write

我还检查了Unix终端中目录树中的所有权限. /Users/myname/...

I’ve checked all the permissions in directory tree in Unix terminal also. /Users/myname/…

Xcode与Finder的区别是什么?关于...

Xcode versus Finder, what are the differences? regarding…

用户名(按名称)

组名(工作人员,根用户,管理员)

group name (staff, root, admin)

启动时的工作目录

对应用和文件的权限(读取,写入,执行)

permissions on App and files (read, write, execute)

应用和文件的位置

/tmp可以用于文件写入吗?

would /tmp location for file writing work?

放置App和文件的最佳位置在哪里?

where would be the best place to put App and files?

App工作目录被App更改为App和文件所在的位置. Xcode->产品->方案->编辑方案->选项->工作目录设置为相同位置. 这无助于Finder的运行情况.

App working directory is changed by App to be where App and files are located. Xcode -> Product -> Scheme -> Edit Scheme -> Options -> Working Directory set to same location. This doesn’t help the Finder run situation.

此应用程序的MS Windows版本可以正常工作. 我已经为iMac OSX环境移植了它,并重新编写了它,并且它在Xcode中运行得很好. Finder案例有什么问题?为什么无法在输出模式下打开文件?

A MS Windows version of this App works fine. I have ported it, re-written it, for iMac OSX environment and it runs great in Xcode. What is wrong with Finder case? Why can’t files be opened in output mode?

我正在考虑以Objective-C风格重新写入文件I/O,但这会很痛苦,不应该 必要的. CString与NSString对我来说是一个很大的痛苦.我不得不使用.mm和 目标-c ++源代码类型可以达到目的.

I’m thinking of re-writing the file i/o in objective-c style but it would be a pain and should not be necessary. CString versus NSString is a big pain for me. I have had to use .mm and objective- c++ source type to get this far.

欢迎和感谢.

推荐答案

全路径名解决了从Finder运行时的所有问题.多个目录位置已成功尝试.感谢Paul R.

Full path names resolves all issues with running from Finder. Multiple directory locations were tried successfully. Awesome thanks to Paul R.

这篇关于从Finder和Xcode运行OSX App的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆