Everyplay / everyplay-ios-sdk

Everyplay SDK for iOS
https://developers.everyplay.com
92 stars 31 forks source link

Unity iOS PostProcess FilePath Error #20

Closed kyubuns closed 10 years ago

kyubuns commented 10 years ago

in Everyplay/XCodeEditor/XCProject.cs

System.Uri rootURI = new System.Uri( ( projectRootPath + "/." ) );

caused error: UriFormatException: Invalid URI: The format of the URI could not be determined: xcode_project/.

I think

System.Uri rootURI = new System.Uri( ( projectRootPath + "/." ) );
↓
System.Uri rootURI = new System.Uri( ( filePath + "/." ));

↑this code generates other bugs :-P

paugit commented 10 years ago

On what Unity version are you having this problem? Are you building on Mac or Windows ?

kyubuns commented 10 years ago

sorry,

System.Uri rootURI = new System.Uri( ( projectRootPath + "/." ) );
↓
System.Uri rootURI = new System.Uri( ( filePath + "/." ));

this code is lie. (create other bugs.)

Unity 4.5.0 using OS X 10.9.2

I think, filePath is not full path. ↓the code may return not full path.

this.projectRootPath = filePath;
in public XCProject( string filePath )
paugit commented 10 years ago

What kind of project/build path are you having? Does it contain special characters?

kyubuns commented 10 years ago

ex.

if( tree.CompareTo( "SOURCE_ROOT" ) == 0 ) {
  Debug.Log(absPath); // -> /Users/hoge/fuga/Assets/Plugins/Everyplay/iOS/Everyplay.framework (full path)
  Debug.Log(filePath); // -> /Users/hoge/fuga/Assets/Plugins/Everyplay/iOS/Everyplay.framework (full path)
  Debug.Log(projectRootPath); // -> xcode_project (not full path, this is /Users/hoge/fuga/xcode_project)
  System.Uri fileURI = new System.Uri( absPath );
  System.Uri rootURI = new System.Uri( ( projectRootPath + "/." ) ); // raise UriFormatException!
  filePath = rootURI.MakeRelativeUri( fileURI ).ToString();
}

no contain special characters.

paugit commented 10 years ago

I was not able to replicate this issue. For me the projectRootPath is logged as full path and does not raise any exceptions. Tested with Unity 4.5 and Mac OS 10.9.2.

paugit commented 10 years ago

Could you try to build a new blank project with Everyplay and see if the problem happens for that too?

kyubuns commented 10 years ago

ex. /Users/hoge/fuga is Unity Project Directory ( /Users/hoge/fuga/Assets, /Users/hoge/fuga/ProjectSettings, /Users/hoge/fuga/Temp, etc... ) Can you test XCode save path == /Users/hoge/fuga/test?

kyubuns commented 10 years ago
Could you try to build a new blank project with Everyplay and see if the problem happens for that too?

I'll try it, later.( I don't use the machine a few hours :-P )

paugit commented 10 years ago

Tried, with same project name in my home dir and building to fuga/test but unfortunately unable to replicate.

kyubuns commented 10 years ago

oh... okey... wait please...

kyubuns commented 10 years ago
if( tree.CompareTo( "SOURCE_ROOT" ) == 0 ) {
  Debug.Log(absPath); // -> /Users/hoge/fuga/Assets/Plugins/Everyplay/iOS/Everyplay.framework (full path)
  Debug.Log(filePath); // -> /Users/hoge/fuga/Assets/Plugins/Everyplay/iOS/Everyplay.framework (full path)
  Debug.Log(projectRootPath); // -> xcode_project (not full path, this is /Users/hoge/fuga/xcode_project)
  System.Uri fileURI = new System.Uri( absPath );
  System.Uri rootURI = new System.Uri( ( "/Users/hoge/fuga/xcode_project/." ) ); // changed
  filePath = rootURI.MakeRelativeUri( fileURI ).ToString();
}

this is success.

kyubuns commented 10 years ago

i'll test blank project.

kyubuns commented 10 years ago

sorry, I cannot replicate in blank project. I'll check other PostProcesses. thank you.

kyubuns commented 10 years ago

i found. This is caused by this code.

BuildPipeline.BuildPlayer(levels, "xcode_project", BuildTarget.iPhone, BuildOptions.None);

This code is working well on Unity and other assts. Can you support this code?

paugit commented 10 years ago

What if you change the "xcode_project" to "/Users/hoge/fuga/xcode_project" ?

kyubuns commented 10 years ago
BuildPipeline.BuildPlayer(levels, "/Users/hoge/fuga/xcode_project", BuildTarget.iPhone, BuildOptions.None);

Build Success when use this.

but,

BuildPipeline.BuildPlayer(levels, Application.dataPath + "../xcode_project", BuildTarget.iPhone, BuildOptions.None);

This is not success.

The following build commands failed:
    CpResource /Users/hoge/fuga/Plugins/Everyplay/iOS/Everyplay.bundle build/test.app/Everyplay.bundle

in XCode project build.

× /Users/hoge/fuga/Plugins/Everyplay/iOS/Everyplay.bundle ○ /Users/hoge/fuga/Assets/Plugins/Everyplay/iOS/Everyplay.bundle

paugit commented 10 years ago

Don't use ../

Do it like this instead:

string dstPath = Application.dataPath.Substring(0, Application.dataPath.IndexOf("Assets"));
dstPath = System.IO.Path.Combine(dstPath, "xcode_project");

BuildPipeline.BuildPlayer(levels, dstPath, BuildTarget.iPhone, BuildOptions.None);
kyubuns commented 10 years ago

excellent! be that as it may, this is bug? or not? (Should I close this issue?)

paugit commented 10 years ago

The problem seems to happen inside a 3rd party tool which we use for editing the xCode project. I don't know if it is a bug or if it just does not support relative paths. I need to take a closer look at it in some point, however you can use the above workaround for now.

kyubuns commented 10 years ago

ok! thank you paugit!

paugit commented 10 years ago

You are welcome :)